- Home /
End Game Collider
I want to create a game in unity3d. for that i need a collider script when a player touch a certain object the game will end or auto quit
Comment
Answer by Munchy2007 · May 13, 2014 at 12:40 PM
using UnityEngine;
using System.Collections;
public class EndOflevel : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other)
{
Application.Quit();
}
}
Attach this script to your gameobject that indicates the end of your level/game. Remove the 2D part of the names if you are using 3D colliders.
Your answer
Follow this Question
Related Questions
Physics.Raycast not hit sometimes 0 Answers
Help with light Switch Script 1 Answer
Cloud recognition in Vuforia 0 Answers
can you use onmouseover without a collider on object 1 Answer