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.

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to change the speed of a Facebook video

Create a beautiful tables using Contrast

Data Sharing in Unrelated Components — Angular

UNDERSTANDING THE “THIS” KEYWORD IN JAVASCRIPT

Fetch using GET, POST, PUT & DELETE in React App (Part II)

Build Node & Mongo Rest API 2018 JWT

Javascript best practices — Shortify falsy/truthy checks

How to implement a dark theme with CSS and Angular?

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

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

More from Medium

Working with Cinemachine

Building A Stealth Game — Helping Your Guards “See”

Creating Elevator in Unity — Part 3: Moving Elevator.

How I used scriptable objects to build a powerup system