Loading Scenes in Unity!!
In every game, there is a starting point — where player or user engage himself to understand the information about the game, its features/levels, controls etc.
Each of these respective section of game are made of Scenes and they are loaded based on when the user or player interact within the game.
In our Galaxy Shooter 2D- lets create a new scene — that is loaded first time when game starts and provides information about the game, who created it and how one can start the new game i.e, load another scene from the first scene.
Click on File-> New Scene , it will create a new scene and save it say “Main_Menu”
Inside Canvas — added image MainMenu and updated it with name Title-Screen_Image and set the size of image as provided in width, height.
Here in our case we will add the button and the text and update the text as below
And we can add the text and provide information who created the game set few properties like alignment needs wrap or overflow text horizontal or vertical.
Once scene is created- one can add the scenes in Build when click on Add open Scenes or drag the scene from the Project tab from scene folder . The scene which are added under build settings assigned with an index number which one can refer in code to load the scene.
Now when we run the Game , it will load the Main_Menu Scene and when click on New Game, there will be on click event handler is called at run-time on button and it calls the MainMenu.LoadGame method.
This MainMenu script is added to the canvas and when it calls the LoadGame() method it loads the Scene having index -1, which open the Game Scene.
Below shows when the MainMenu is selected , it open the Game Scene..
@GameDevHQ-Day …