Now that we have the main menu finished, let's continue doing this with the pause menu:
- Go ahead and open up our Gameplay scene. Update the PauseScreenBehaviour script to have the following implementation of SetPauseMenu:
/// <summary>
/// Will turn our pause menu on or off
/// </summary>
/// <param name="isPaused"></param>
public void SetPauseMenu(bool isPaused)
{
paused = isPaused;
// If the game is paused, timeScale is 0, otherwise 1
Time.timeScale = (paused) ? 0 : 1;
// No longer needed
//pauseMenu.SetActive(paused);
if (paused)
{
SlideMenuIn(pauseMenu);
}
else
{
SlideMenuOut(pauseMenu);
}
if (paused)
{
var result = Analytics.CustomEvent("Paused");
if (result == AnalyticsResult.Ok)
{
Debug.Log("Event Sent: Paused");
}
}
}
Note that because PauseMenuBehaviour inherits from MainMenuBehaviour, it also...