- Home /
 
keep getting this error "Unexpected token: 10." any ideas whats wrong?
 var health = 15;
  
 function Update () {
     print(health);
 }
  
 function OnTriggerEnter (other : Collider) 
     {
      if (other.gameObject.CompareTag("Enemy"))
        {
         health -= 5;
        }
 
        if (health = 10)
        GameObject.Find("(1)Green").SetActiveRecursively(false);
        
     }
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by kmeboe · Sep 25, 2013 at 10:23 PM
Your second "if" statement is trying to set health to 10, which javascript doesn't like (and probably isn't what you meant, either). Try this instead:
 if (health == 10)
 
              Your answer
 
             Follow this Question
Related Questions
Need help calling a variable from another C# script 1 Answer
Calling a variable from another class 2 Answers
Sorry Me again :P Error CS0131 1 Answer
Variable from other class always returns 0 1 Answer
Critical problem in importing scripts 3 Answers