So, following up from yesterday – today was about the Beginner Code tutorial on Unity. It was, as the name says, very beginner — it did a lot of introducing the concepts of variables and functions, which meant that I skimmed those sections.
The tutorial started out pretty simple, with a general rundown of how computers, compilers and code all work together, as well as exploring the game to see how different parts of the world work. Then it went into examining scripts, and how to read through C# when written out.
One thing I really appreciated was that the tutorial made a point of introducing a term that would make no sense without explanation, then immediately linking the documentation and walking you through how to use it. Beginning programmers, like the sort this tutorial is aimed at, may not know what documentation is, or where to find it, or even how to use it; this setup specifically showed how to find it, and then how to interpret what the answers were. This was also nice because Unity uses some specialized terms that are not necessarily present in C# broadly, so when I went to look them up in C#’s documentation, I had a lot of trouble.
The tutorial walked you first through variables and then through functions by having you edit a script which spawns health potions at the start of the game. The variable you change affects the distance from a central point the potions spawn; the function you change refactors the code to prevent the same function being rewritten four times.
It has been a while since I wrote code, because I made a pretty silly mistake: I didn’t type my variables when I instantiated them in my function, which led to the same error eight times over, and couldn’t figure out what I’d done wrong. Hopefully I’ll take that lesson forward. It’s been a while since I’ve worked in a strictly typed language.
I actually worked a little bit ahead, since skimming through the explanations of variables and functions left me with extra time, and managed to get through tomorrow’s agenda and even a little bit of Thursday’s. I’ll be moving things up to compensate.
Leave a Reply