- Home /
Collision Detector script
I have a bike gameobject and a wheel gameobject. The bike has a script that make it moves. The wheels have a script that detects collision and turn true a grounded variable.
function OnCollisionEnter(collision:Collision)
{
if(collision.gameObject.tag == "Ground")
{
bike controller.grounded = true;
}
}
The console tells me that i have to put a semicolon at line 5(bike controller.grounded = true;)
What's the error?
Answer by · Sep 18, 2010 at 04:24 PM
The error lies exactly where the compiler is telling you. You have an (unexpected) space, so it warns and suggests adding a semicolon (i.e. "bike;")
Are you trying to call a variable that has a space in the name? i.e. "bike controller" ? Or setting a variable on a different script? Either way, what you have won't work.
If it's a variable, name it bikeController. If it's another script or static variable, apply those methods accordingly.
Your answer
Follow this Question
Related Questions
Desintergrate Enemies on Dying 4 Answers
script help 2 Answers
Making it display a Gui 2 Answers
UCE0001: ';' expected. Insert a semicolon at the end? 2 Answers
whats wrong wrong with my script 4 Answers