- Home /
Question by
Telamon25346 · Dec 08, 2015 at 12:10 PM ·
collidertrigger2d-platformercollider2dtriggers
Collider that restarts the game?
i have a character that is moving on a plane and is using a 2d rigid body collider. whenever the character runs into the 2d box trigger that i created, i want the game to restart. how would i create a script that starts an event when the character enters the trigger zone and then the event restarts the game ( Application.LoadLevel (0);
) ?
Comment
Best Answer
Answer by fffMalzbier · Dec 08, 2015 at 12:11 PM
http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnTriggerEnter2D.html
void OnTriggerEnter2D(Collider2D other) {
//check if the other collider is the player
//if yes do
Application.LoadLevel (0);
}
Your answer
Follow this Question
Related Questions
Does OnTriggerStay ignore layers? 1 Answer
Translate Jump Trigger Collision Issue 1 Answer
Destroying objects within collision 1 Answer
changing gravity OnTriggerEnter 1 Answer
How to Specify a Collider in OnTriggerStay function? 1 Answer