December 2nd, 2016 at 12:00

Lecture 6: Scripts and Components II

In lecture 6 we continued further into the basics of programming. We started the lecture with a short review of data types, operators, and methods (aka functions).

In terms of new material, we looked into how to create arrays, as well as how to access the values that are stored inside them. We further discussed the concept of creating loops, specifically while, for, and foreach loops.

Finally, we looked at the general structure of a Unity script and how we can access variables and methods that have been defined in other scripts. For this we looked at a theoretical example, as well as a practical example - the creation of an alarm light that triggers when a player approaches it.

You can download the script we created during the lecture in the sidepanel. We have added a lot of extra silly things to it in the lecture - such as the instantiation of cubes. So be aware that the script is not longer ‘just’ an alarm light.

For more information about the topics in this lecture, check out the following links: