Loading Scenes in Unity

Unity has made it easy for us developers to load scenes, which is pretty important. Sure you could do everything in one single scene, but that might be more trouble than it’s worth.

To be able to load scenes we have to import the namespace with the required methods, UnityEngine.SceneMangement. The name is pretty obvious, which is good! To load a scene is pretty straightforward. Simply use the LoadScene method in the SceneManager namespace.

One thing to note: to be able to load a scene it has to be present in the project's build settings.

The LoadScene method can take either the name of the scene or the number it has in the build settings.

Isn’t it great how Unity has given us tools to make creating games easier? 😀