Quantcast
Channel: Answers by "ransomink"
Viewing all articles
Browse latest Browse all 80

Answer by ransomink

$
0
0
Cambob script public function DoSomething () { Debug.Log ( "You should be doing something..."); } Script that calls the function // this variable will show up in the inspector // place the GameObject that has the Cambob script attached to it inside the variables' field public var bobScript : Cambob; function Update () { bobScript.DoSomething (); } You can also reference the Cambob script through code so you don't have to use the editor, but this method is slower. // I made it private because there is no need to use/change it inside of the editor // (unless you want to check if the correct GameObject appears when executed). private var bobScript : Cambob; function Awake () { bobScript = GameObject.Find ( "The GameObject Name" ).GetComponent ( Cambob ); } function Update () { bobScript.DoSomething (); }

Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>