- Home /
Unexpected token: collider on simple ladder script
hi guys i get and error saying: Assets/scripts/ladder.js(27,34): BCE0043: Unexpected token: Collider. my script is
var Player : GameObject;
var CanClimb : boolean = false;
function Update () {
if(Input.GetKey(KeyCode.W)){ if(CanClimb == true) } else Debug.Log("Player can't climb"); } if(!Input.GetKey(KeyCode.W)){ if(CanClimb == true) } else Debug.Log()
}
function (OnTriggerEnter (other : Collider) {;
if(other.gameObject.tag == "Player"){
CanClimb = true;
}
}
function OnTriggerExit;{ (other ;Collider) )
if(other.gameObject.tag == "Player"){
CanClimb = false;
}
}
}
Your code syntax is a complete mess... you might want to start with one of the scripting tutorials, because these lines just make no sense:
if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.W)){ if(CanClimb == true) } else Debug.Log("Player can't climb");}
function (OnTriggerEnter (other : Collider) {;
function OnTriggerExit;{ (other ;Collider) )
You could start with http://unity3d.com/learn/tutorials/modules
Answer by MrCranky · Jan 13, 2014 at 03:45 PM
You've got random semi-colons all over the place; it's the semi-colon between 'other' and 'Collider' on the line referenced (27) which is your problem. It should be a colon, not a semi-colon. The part of the error message "(27, 34)" means line 27, 34, and points precisely to your problem.
Your answer
Follow this Question
Related Questions
Ignore child intercollision, not parent-parent 0 Answers
Multiple colliders on one gameobject 0 Answers
code your own colision system i unity 0 Answers
I can't get my objects to collide 1 Answer