Loading scenes in Unity

Switching and loading scenes in Unity using their built-in functions is very simple.

Add this to the script

In a function, use “LoadScene(Scene Name);”:

Or alternatively, use “LoadScene(Scene Build Index);”:

Remember:

If using the scene name, it must be exactly the same as what the scene is called in your project files.

If using the build index, it must be the same as the build index for the scene, found by going to “Edit/Build Settings”. Add all the scenes you want to include in the build, then use the index shown to the right of the scene name to load it.

Additionally:

There are also ways that you can change how scenes are loaded, such as “LoadSceneAsync”. Unlike “LoadScene”, “LoadSceneAsync” loads the specified scene in the background, while keeping the current scene loaded and running. This can be useful for a larger game that needs a loading scene when switching levels/scenes.

--

--

--

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

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

Recommended from Medium

Route 53 Typical Exam Questions. AWS Solutions Architect Associate Complete Course

AWS Route 53 AWS Solutions Architect Exam Questions.

How to deploy to IIS using Azure DevOps YAML pipelines

FP 360 Week 14

Community, Meetup und Tech-Events 1.-6. Oktober 2019 in Frankfurt und RheinMain-Gebiet

Another Wave, the Same Mistakes

Android Continuous Integration using Fastlane and CircleCI 2.0 — Part I

Working With Unity’s Navigation System

WhatsApp Android Latest Review

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
Vincent Taylor

Vincent Taylor

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

More from Medium

Light layers in Unity HDRP

Cinematography in Unity — Skyboxes

Using Light Layers in Unity

Pushing Objects in Unity to Complete Puzzles