Start the Game With Scene Manager- Game Dev Series 112
Quick guide: load main game level with Scene Manager.
In this quick tutorial, we will locate the scene index of current scene and use it to load the next scene.
Before we start it, you need to have a functional main menu scene and a ready-to-play game scene.
Build index of scene
In this article, we will load the game scene with a faster way.
We used to load the next scene by its name.
In fact there is a build index in build setting and we could use that to load scenes.
This would allow us to load scenes faster than type in the whole name.
GetActiveScene().buildIndex
First we need to get the scene index integer of Main Menu.
Once we got the current scene index, we can use it to Start Game.
And don’t forget to load the scene with current scene index plus 1. That would be main game scene in build order.
Using build index can also make you easy to load the next scene without rewrite the script. Simply use this script to any button needs to load the next scene in order.