- Home /
When player collides with object load next level
Hi I need help
When player collides with object how can I get the game to load next level but instead of making loads of scripts how can I make this one re-useable
Thanks
Answer by Mander · Aug 03, 2012 at 04:55 PM
var level : String;
function OnTriggerEnter( hit : Collider){
Application.LoadLevel("SCP_Level"+level);
}
here u can apply this to a gameObject. when u enter this trigger it will load ur next lvl
my lvlnames are like this "SCP_Level1" so the var level will define ur level just change that numer when u attach the script in the trigger.
hope this helps.
Thanks it worked .. i did change it a tiny bit .. to this
var level : String; function OnTriggerEnter( other : Collider){ if (other.CompareTag ("Player")) { Application.LoadLevel("Level"+level); } }
because of my settings :) Thank you so so so much
Your answer
Follow this Question
Related Questions
load level when no enemy car are left 2 Answers
FSM: loading newScene before accesing newState 0 Answers
allowSceneActivation give me error message 0 Answers
collision with objects, physics 1 Answer
Load Scene by audio clip 2 Answers