O'Reilly logo

Building an RPG with Unity 5.x by Vahé Karamian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Improving Game Master

The code we have so far works, but it is not very clean. Let's go ahead and structure the code a little better. Let's go ahead and create a new script called LevelController.cs. This new script will be handling the logic for our level management.

Level controller

Here is a listing of LevelController.cs:

using UnityEngine; using UnityEngine.SceneManagement; using System.Collections; /// <summary> /// This class is used to make referencing easier in the code /// </summary> public static class SceneName { public const string MainMenu = "MainMenu"; public const string CharacterCustomization = "CH4_CC"; public const string Level_1 = "CH5"; } public class LevelController { // let's have a reference to the current scene/level public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required