Pregunta

I faced with such problem: i've added function to my simple browser game for collect items and earn scores, from Unity Docs:

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

and I can't get even see my "test" alert. Instead I'm getting the below error

"Syntax Error: missing ) after formal parameters" with point at " : " after " collision ".

Also I tried OnTriggerEnter, but result was the same.

¿Fue útil?

Solución

reframe your function like this

function OnCollisionEnter(collision='Collision') { alert('test'); }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top