Domanda

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.

È stato utile?

Soluzione

reframe your function like this

function OnCollisionEnter(collision='Collision') { alert('test'); }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top