- Home /
Question by
Jammer3000 · Dec 26, 2012 at 06:20 PM ·
sceneload
How to load a scene on collision
Hi I need to know how to load a scene on collision, for example I want it so when the first person controller collides with my door object the next scene will load. Thanks
Comment
Best Answer
Answer by clunk47 · Dec 26, 2012 at 06:39 PM
void OnCollisionEnter(Collision coll)
{
if(coll.gameObject.tag == "exit")
Application.LoadLevel(string level name or int level);
}
If you want to use trigger instead of collision, use Collider instead of Collision like so.
void OnTriggerEnter(Collider coll)
{
}
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Load Scene When... 1 Answer
Load and Save Scenes with PlayerPrefs.Set/GetInt 0 Answers
level loader script wont work 1 Answer
Endless DeathZone??!!? 4 Answers