- Home /
Question by
CB-TV · May 02, 2014 at 06:43 PM ·
collidercollider2dboxcollider2dontriggerenter2d
Unexpected token: collider?
I have three errors:
"BCE0043: Unexpected token: collider.
BCE0044: expecting ), found 'collider'.
BCE0043: Unexpected token: )."
These errors correspond to these lines of my script with the first error being the first line and the second and third error being the second line below:
function OnTriggerEnter2D (Collider2D collider)
var widthofBgObject : float = ((BoxCollider2D)collider).size.x;
I don't think I need to provide anymore of the script since this is a simple problem and I believe I have ended up like this from a C# to UnityScript coversion I did.
Thank you!
Comment
Best Answer
Answer by tanoshimi · May 02, 2014 at 09:03 PM
You're mixing C# and JavaScript syntax. Assuming you meant to write in JavaScript, the method signature should be:
function OnTriggerEnter2D(collider : Collider2D)
Any idea how to convert this:
((BoxCollider2D)collider).size.x;