Using Dot Syntax in a script

Now that you know that each Component object resides in computer memory, storing data in variables, it's time to use Dot Syntax to access those Component variables and methods.

Accessing a Component's own variables and methods

Dot Syntax can be used to access any pubic variable or method on any Component on any GameObject. Even though a Component always has access to its own variables and methods, we can still use Dot Syntax if we want.

In order to have access to a variable or method, we have to know its location. Let's start by looking in LearningScript.

Here's an overview of how to access a variable or method from within the current Component:

Accessing a Component's own variables and methods
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.197.213