Let's change a few lines of code in LearningScript
to show how to assign the Capsule GameObject to the variable capsuleGO
using drag-and-drop.
//
), or remove it.public
like this: public GameObject capsuleGO;
The Capsule GameObject is now assigned to the capsuleGO
variable. We didn't have to write the code because Unity has done the assignment internally for us. Also, this doesn't change LearningScript
in any way.
Q1. What is Dot Syntax, and what does it allow you to do?
Q2. When an object is assigned to a variable, what is actually stored in the variable?
Q3. Are there any limits to using Dot Syntax when trying to access variables and methods?
Q4. What is another way to assign GameObjects to variables besides writing code?
3.144.9.169