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 has written. This means that all the properties that we see in Inspector are just variables of some type. They simply store data that will be used by some method.
Unity changes script and variable names slightly
When we add our script to a GameObject
, the name of our script shows up in the Inspector panel as a Component
. Unity makes a couple of small changes. You might have noticed that when we added LearningScript...