- Home /
Unexpected token
Hi. I recently started programming more major projects, and i hit a problem that i cannot seem to figure out, there are no awnsers on the internet i could find also.
This is the part of the code that i cannot seem to figure out where the mistake is:
function OnControllerColliderHit(c : ControllerColliderHit){
if(c.transform.tag == "Ladder"){
climbing = true;
if(Input.GetKeyUp(KeyCode.E)){
CM.enabled = false;
}
}
}
function Update(){
if(!OnControllerColliderHit(c : ControllerColliderHit)){
climbing = false;
CM.enabled = true;
}
}
Anyone can tell me where i am making a mistake?
Very hard to say with the code formatted like that. On which line is the error.
if(!OnControllerColliderHit(c : ControllerColliderHit)) This is the part where it says it is wrong, i think its something with the argument
Oh yeah - that's kinda totally wrong :S !!
So what is wrong is that when you call a function you don't pass the type of the parameter like that - only do that when you are defining a function.
I can't work out what you are doing though - what are you trying to do in Update? See if it wasn't hit? You wouldn't call that function like that in any case...
Its suppose to be like this: If the character controller isnt touching a game object called "ladder", it will do "stuff"
is it wrong? how am i suppose to do it?
Your answer
Follow this Question
Related Questions
How to use unlimited parameters in a function? (JS) 1 Answer
Return multiple parameter 3 Answers
Problem with sending arguments through a function. 1 Answer
How to pass a Transform Array as an argument into a function in C#? 1 Answer
Question about classes [will specify once I know what the name of what I'm looking for is] 0 Answers