- Home /
Question by
dev_collindavis · Apr 19, 2016 at 04:58 AM ·
c#javascriptapplicationapplication.loadlevel
Teleport to next scene on trigger
I was wondering if there is a script I can use that can be usable across many scenes without having to go and change the integer of the scene every time I want to progress in levels.
Comment
Best Answer
Answer by Guhanesh · Apr 19, 2016 at 06:40 AM
void OnTriggerEnter(Collider other) {
if(other.gameObject.tag=="LevelTrigger")
{
int y = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(y+1);
}
}
Add tag "LevelTrigger" to the Trigger. Above script will load the next level in build settings.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Unity 5.3 How to load current level 3 Answers
Multiple Cars not working 1 Answer
Menu on Android Application 1 Answer
how do i make a simple inventory like in black ops? 1 Answer