Quantcast
Viewing latest article 1
Browse Latest Browse All 4

Answer by robertbu

We see the scripts, but not the object hierarchy. - A component is a script on a specific game object, so unless all these components are on the same game object, you have to identify the game object. GameObject.Find() or GameObject.FindWithTag() are the typical solutions. - Use GetComponent() without the quotation marks. ---- motorInput = GameObject.Find("SomeObject").GetComponent(CarControl); ...or if it is on the same game object as the script: motorInput = GetComponent(CarControl); [http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html][1] [http://unitygems.com/script-interaction-tutorial-getcomponent-unityscript/][2] [1]: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html [2]: http://unitygems.com/script-interaction-tutorial-getcomponent-unityscript/

Viewing latest article 1
Browse Latest Browse All 4

Trending Articles