Let's talk about the call in two cases, namely the call of scripts in the same game object and the call of scripts of different game objects;
1. In a game object, the script call is very simple, as shown below:
Var Contro;
Control = GetComponent (scriptname); // scriptname indicates the name of the script to be called.
2. In different game objects, it is not difficult to call scripts, that is, to find the game objects first, and then find the scripts. You will understand the code.
<Pre class = "html" name = "code"> var aa: GameObject;
Aa = GameObject. Find ("GameObjectname"); // GameObjectname indicates the game object you want to call.
Var mus: scriptname = aa. GetComponent (scriptname); // scriptname indicates the name of the called script.
Note: If you write the code outside the function, it may be wrong. If an error occurs, cut it into the function.
Let's talk about it. It's simple. We often use it ~~~
From dlnuchunge's column