Chapter     4

Using Scripts and the GameObject

Now that you have programming basics under your belt and a good grasp on the Unity editor and accompanying developer tools, it’s time to introduce scripting to the game scene.

Scripts work hand-in-hand with the Unity game engine. Your scripts customize game object behaviors using the classes, functions, and variables of the Unity API. You’ve already seen when you create a new project, Unity creates a very basic, functional game that consists of one empty scene. Similarly, when you create a new script, Unity populates it with an empty Start() and Update() function.

The Unity game engine does a lot of work behind the scenes. It runs the Start() and Update() functions on every game object whether you ...

Get Learn Unity 3D Programming with UnityScript: Unity's JavaScript for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.