- Home /
UCE0001: ';' expected.
I am completely stumped on this error. Please tell me what I am doing wrong in this script. The error says I need to place a semi-colon at the end, but I already have. I have in fact saved the script, and restarted unity too. Is my script file corrupted, or should this go under the FixedUpdate() or other function area?
#pragma strict
function Update(){
var InfoText : GameObject.Find("Building Mode GUIs/Stats GUI/InfoText");
InfoText.text = "Price: " + PriceAdding;
}
UCE0001: ';' expected. Insert a semicolon at the end.
This is at line "var InfoText:...." I cut out the rest of my script because the script was working rather fine before I added this, and it is very long.
Thank you guys in advance.
Answer by YoungDeveloper · Dec 02, 2014 at 02:43 AM
You are doing it wrong. You have to:
Find the GameObject
var go:GameObject = GameObject.Find("gameObjects Name");
Read what it does. http://docs.unity3d.com/ScriptReference/GameObject.Find.html
GetComponent from script
I explain it very clearly in these two topics.
http://answers.unity3d.com/questions/550578/cant-understand-getcomponent-c.html
http://answers.unity3d.com/questions/597617/how-do-i-addsubtract-variables-between-two-differe.html
Make your changes.
Answer by flaviusxvii · Dec 02, 2014 at 02:47 AM
var InfoText : GameObject.Find("Building Mode GUIs/Stats GUI/InfoText");
I think you meant to do:
var InfoText : GameObject = GameObject.Find("Building Mode GUIs/Stats GUI/InfoText");
No, I believe InfoText is a component in his case. He's trying to find gameobject and access it as a script. In his case it would be something like this.
var go:GameObject = GameObject.Find("gameObjects Name");
var InfoText:Script = go.GetComponent(Script);
InfoText.text = "hi";
Your answer
Follow this Question
Related Questions
UCE0001 ";" expected. insert a semicolan at the end? 1 Answer
UCE0001 error Insert a Semicolon at end 1 Answer
What am I missing? I already have the semicolon at the end.. 1 Answer
; expected. Insert a semicolon at the end. 1 Answer
help with UCE0001: ';' expected. Insert a semicolon at the end 3 Answers