- Home /
Question by
FranchiseGames · Jul 27, 2012 at 01:46 AM ·
error
Assets/cubeAI.js(2,11): UCE0001: ';' expected. Insert a semicolon at the end.
the error Assets/cubeAI.js(2,11): UCE0001: ';' expected. Insert a semicolon at the end. keeps coming up. heres my script.
var health - 10;
var TakeDamage : boolean;
function OnTriggerEnter(other : Collider){
if(other.tag == "Player"){
TakeDamage = true;
}
}
function OnTriggerExit(other: Collider){
if(other.tag == "Player"){
TakeDamage = false;
}
}
function Update(){
if(TakeDamage){
if(Input.GetButtonDown("Fire1")){
health --;
}
}
if(health <- 1){
print("Enemy Down!");
health - 0;
Destroy (gameObject);
}
}
and i do have a semicolon. im a newb watching tutorials on youtube. i cant continue with the tut until i fix this so please help.
Comment
Answer by syclamoth · Jul 27, 2012 at 01:58 AM
You are using the wrong symbol in the first line:
var health - 10;
this means nothing. It should be
var health = 10;
Similarly near the bottom, where you should be setting the health to zero, you need
health = 0;
rather than
health - 0;
which of course does nothing.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Targetting error please help 0 Answers
Failed to load Unity.dll 4 Answers