문제

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.

도움이 되었습니까?

해결책

reframe your function like this

function OnCollisionEnter(collision='Collision') { alert('test'); }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top