Understanding Component properties in Unity's Inspector

GameObjects have some Components that make them behave in a certain way. For instance, select Main Camera and look at the Inspector panel. One of the Components is the Camera. Without that Component, it will cease being a camera. It would still be a GameObject in your scene, just no longer a functioning camera.

Variables become Component properties

Any Component of any GameObject is just a script that defines a class, whether you wrote the script or the Unity's programmer did. We just aren't supposed to edit the scripts that Unity wrote. This means that all the properties we see in Inspector are just variables of some type. They simply store data that will be used by some methods.

Unity changes ...

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.