- Home /
Why doesnt my script work
Whenever I make any script Unity always has the same problem "Expecting EOF, found (whatever i have put in). Why is this happening...here is an example..
var health: float = 10.0;
var maxHealth: float = 10.0
var playerController: TankControl; playerController = GetComponent(TankControl); var controller : CharacterController; controller = GetComponent(CharacterController);
funtion ApplyDamage(damage: float){
health-=damage;
if health <=0){
health = 0;
Die()
}
}
i would the state the funtion of (die) later but anyway the same error keeps coming up expecting EOF found (something)
there are some semicolons missing, though I doubt thats the issue. also you wrote 'funtion' and not 'function' and you have no open bracket in your if clause
please check your code before submitting, otherwise we can't really help you
Do you have this problem only with javascript or also with c# and Boo?
Answer by worldofcars · Feb 15, 2012 at 08:51 PM
I think here is the problem... replace this into your script:
function ApplyDamage(damage: float){
health-=damage;
if (health == <0){
health = 0;
Die();
} }
thanks guys this was really helpful I will try to remember in the future.
Answer by perchik · Feb 15, 2012 at 08:43 PM
You need a semicolon after every instruction:
var maxHealth: float = 10.0 ;
and
Die() ;
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Unity error CS1014 1 Answer
Script for tank fire 0 Answers
What am i doing wrong in this code? 1 Answer
Error... that I don't understand. 3 Answers