Quantcast
Channel: Latest Questions by adamantium014
Viewing all articles
Browse latest Browse all 4

Proper syntax for GetComponent

$
0
0
Im trying to access goldAmount on the mainScript thru the goldScript which is on the gold GameObject. I cant for the life of me figure out the GetComponent action. Here are my two scripts: **mainScript** var customStyle3: GUIStyle; var size : Vector2 = new Vector2(60,20); public var goldAmount : int; function OnGUI() { GUI.Label (Rect(Screen.width /2 , 0, size.x, size.y), "Gold : " + goldAmount, customStyle3); } **goldScript** function addGold() { //mainScript = GameObject.Find ("Main Camera").GetComponent(goldAmount); //goldAmount ++; //Destroy (gameObject); } function Start() { WaitForSeconds(3); addGold(); }

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images