- Home /
Is my Unity Bugged? Or am i an idiot?
Im trying to make it detect a collision between the gameobject and the floor but every time i press build to check it says there should be a parenthesis where the OnCollisionEnter phrase is in the function? Example:
function OnCollisionEnter(CollidedWith : Collision) { error expecting (, found'OnCollisionEnter'
if(CollidedWith.gameObject.name == "Floor"){
JumpCount = 0;
}
}
Tell me if i made a mistake or its a glitch and how to fix it. Just plz help!
What about the line above this part?
Also, take 1 $$anonymous$$ute and format this code. This is barely readable. And if you are adding error message to the code, make it as a comment so it doesent confuse us.
It would also help to see a few lines preceding this piece of code, the problem could very well be hidden there.
added an answer. He's new and most new users don't know they have comments, they just see 0 answers and dont click on it thinking nothings changed.
Answer by superluigi · Aug 07, 2013 at 06:45 AM
if thats your code exactly as it is in the script then you're missing an } at the end. Anyway your problem may be coming from the code above this funtion. Here's how you will get this fixed, copy your entire code, paste it here, highlight it and press the code button next to bold and italic
I turned that one as an answer thinking you go tit right but actually there is the right amount of brackets...
Your answer