By using a little Unity magic, a script becomes a Component
While working in Unity, we wear the following two hats:
- A Game-Creator hat
- A Scripting (programmer) hat
When we first wear our Game-Creator hat, we will be developing our Scene, selecting GameObjects, and viewing Components; just about anything except writing our scripts.
When we put our Scripting hat on, our terminology changes as follows:
- We're writing code in scripts using MonoDevelop
- We're working with variables and methods
The magic happens when you put your Game-Creator hat back on and attach your script to a GameObject. Wave the magic wand — ZAP — the script file is now called a Component, and the public variables of the script are now the properties you can see and change in the Inspector ...
Get Learning C# by Developing Games with Unity 3D Beginner's Guide 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.