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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

99 Followers

A passionate gamer whose goal is to work in video game development.