Tutorial to add more scenes to the game
before doing anything we backup the file GameFlowManager.cs with ctrl + d.
open file GameFlowManager.cs
A) add 3 variables
the explanation is descriptive the use we see later
Scene m_Nivel; is to get the name of the current Scene at the time of starting the game.
With m_Nivel_actual we will get only a part of the name of the scene, this point is explained later
and m_Nivel_Nuevo; It is to send to call the new scene through a simple process of concatenation of chains.
b) in the method -- void Start ()
before the }
add these lines
m_Nivel = SceneManager.GetActiveScene ();
m_Nivel_ivel = m_Nivel.name.Substring (5, 1);
m_New_Level = Convert.ToInt32 (m_ Current_Level) + 1;
What does each line do:
m_Nivel = SceneManager.GetActiveScene (); --- get the name of the scene in my case would be Act-1
m_National_level = m_Nivel.name.Substring (5, 1); --- extract only the numeric part of the scene name and store it in a variable
m_New_Level = Convert.ToInt32 (m_Current_level) + 1; --- I perform a data conversion of type string to integer.
This is to initialize the game with controlled data, and know what scene I am and what is next to load