FIND THE ANSWERS

How to use OnTriggerEnter in C sharp?

Answer this question

  • How to use OnTriggerEnter in C sharp?


Answers

Answer #1 | 20/12 2013 06:25
unction OnTriggerEnter (other : Collider) { Destroy(other.gameObject); }
Answer #2 | 20/12 2013 07:08
Looks like you're using Unity, Awesome :) Now before you want to load a scene, you want to check if the player collides with the ground. To trigger the OnCollisionEnter function, you have to make sure that both objects have a collider! Attach the folowing piece of code in a script to the object where the player will be colliding with: void OnCollisionEnter(Collision col) { if(col.gameObject.name == "") { Application.LoadLevel(""); } } I might have looked over a capital or convertion, but those errors pop up right away and show you exactly what to fix, since I'm on my mobile, and can't test it.Gl in further programming!

Possible answer