- Home /
Unexpected Token: Collider.
Hello, my problem is that i get an error message as below. The script is to make sure that my character controller goes through the rings in the correct order.
Assets/rings.js(20,51): BCE0043: Unexpected token: Collider.
import System.Collections.Generic;
var list = LinkedList.<BoxCollider>(); var current : LinkedListNode.<BoxCollider>;
function Awake()
{
list.AddLast(new BoxCollider());
current = list.First;
}
function OnTriggerEnter(BoxCollider Collider)
{
if(collidedWith == current.Value)
{
current = current.Next;
}
}
if anyone has any solutions, or help, it'd be very much appreciated.
Answer by StephanK · Nov 04, 2010 at 07:52 AM
You can't use the word Collider as variable name. The compiler thinks you mean the "type" Collider. You should always use words starting with lowercase letters for variable names to avoid this type of error.
EDIT: Sorry I overlooked that you are using javascript. if you pass parameters to a function the syntax is not (BoxCollider collider) but rather (collider : BoxCollider)
I changed it to several different things, and it says the exact same error message, but replacing Collider with what i wrote.
I edited my answer. I overlooked that this should be javascript code.
Your answer
Follow this Question
Related Questions
Unexpected Token }. 1 Answer
Unexpected token: .. 1 Answer
Converted a script from C# to JS, Unexpected Token: .. What did I do? 1 Answer
java script error 2 Answers