-
Book Overview & Buying
-
Table Of Contents
Learning C# by Developing Games with Unity 5.x - Second Edition
By :
Our script has variables for holding data, and our script has methods to allow tasks to be performed. I now want to introduce the concept of communicating with other GameObjects and the components they contain. Communication between one components GameObject and another component GameObject using dot syntax is a vital part of scripting. It's what makes interaction possible. We need to communicate with other components or GameObjects to be able to use the variables and methods in other components.
When you look at code written by others, you'll see words with periods separating them. What the heck is that? It looks complicated, doesn't it. The following is an example from the Unity documentation:
transform.position.x
Don't concern yourself with what the preceding code means, as that comes later. I just want you to see the dots.
This is called dot syntax. The following is another example. It's...