[Video][Game Making Tutorial 6] Making a Second Level and Saving Game State


In this one, we went ahead for some crazy and more advanced tools. Let´s talk about them:

Door Graphic

Door Graphic

  1. Prefabs: We set our Main Camera and Player as Prefabs. They´re objects that get stored in memory to be reused anytime you need them. So you can store anything you need to reuse and not have to build it from scratch again. They´re great tools.


  1. Adding a new Scene: Creating a new scene is the way to make more levels for your game. Just go to the File menu and click Add Scene, it´ll ask for you to save changes on your current scene and add the other one so you can work on it. Try to save your progress as much as you can so you don´t lose your work.


  1. Code: Application: The “Application.” Tool is very useful; it lets you, among other things: Load a new scene, reload the current scene, get the name of the current scene, and get the ID of the current scene. You can then use this information to compare in IF statements (If this level´s name is… or If this level´s ID is below…), which proves useful in many situations, as shown in the video.


  1. Build Settings: In Build Settings, the game´s platform of development can be selected, among many other settings in which we won´t get deep for now. Just Add your scenes to the list and memorize their number. Of course, it´s recommended that 1 be 1 and 2 be 2, but sometimes they can be messed up (where are Shops? Inns? Etc.)


  1. LoadLevel(int): Using the number coming from Build Settings and the Application.LoadLevel tool, we can load any scene from anywhere. Examples: Buttons, Menus, Keypresses, Triggers, Collisions, Death of the Player.


  1. PlayerPrefs: This is the fun part of the tutorial. PlayerPrefs will allow you to save whatever is going on in the scene in a global variable named by you at the moment of the saving. It can be used as Int, Bool or String.


  • SetInt/Float/String and PlayerPrefs.GetInt/Float/String = For SetInt/Float/String, you should do SetInt/Float/String (NameoftheInt/Float/String, value), so then you can GetInt/Float/String (NameoftheInt/Float/String). It is pretty straightforward.



This tutorial is more advanced than the previous ones, but I really am not looking to follow conventions here. I´m hearing suggestions on how to do interesting and helpful stuff! And this one – the saving, we´ll see some more about that in the next tutorial. That one is going to be about Menus! Stay tuned!


Leave a Reply

Your email address will not be published. Required fields are marked *