SyntaxError: missing ) after formal parameters

Hi there! I faced with such problem: i’ve added function to my simple browser game for collect items and eart scores, from very simple example here on Unity Docs:

function OnCollisionEnter(collision : Collision) {
alert(‘test’);
}

and I can’t get even see my “test” alert. Instead of this i get error: “Syntax Error: missing ) after formal parameters” with point at " : " after " collision ". May you advice me smth helpful?

Also I tryed OnTriggerEnter, but result was the same.

I’m not sure if alert is a function you created? But if you want to call the browsers javascript alert dialog you may want to check out the API for external eval:

Unity WebPlayer and browser communication

Second, changing the type in the function to a string isn’t helpful. It would appear you’re doing all this in actual javascript? Are you trying to do this in the client side browser?

Please describe your issue and what tools you are using.