How to add a restart to my 2D game?
Hello guys
I'm making a Pac-Man type game where my character runs around a board and gets chased by an enemy. I have yet to finish testing the death code for when they collide as I am experiencing a lot of other errors. Besides that, I need to be able to restart the game when the player dies in a similar way to the Space Shooter tutorial. Character dies, text appears asking to restart, and then it brings me back to my main menu. However, since I am so new to Unity, I have no idea how to do this.
My main menu is barely functioning from what I know of and is what has been causing me the most issues (code below)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Menu : MonoBehaviour {
public bool isStart;
public bool isQuit;
void OnMouseUp()
{
SceneManager.LoadScene ("CellPhoneChaser");
}
{
public void QuitGame()
Application.Quit();
}
}
Now, my question is, do I create an entirely new C# script to be able to make this happen? Does it need to go into my Main Menu script? How would I do this? Any help/assistance is greatly appreciated. Even links to videos would be helpful.
***Note: For this game, it is possible it may be put onto an arcade machine so I need to be able to make the restart button easily changeable between PC/arcade. If needed, I can provide which buttons on PC are the buttons on the arcade machine.
Your answer
Follow this Question
Related Questions
Restart option on game over? 1 Answer
OnClick() event script from a prefab 0 Answers
Referencing a button in script for different game modes in the Space Shooter Tutorial 0 Answers
LoadScene not Working 1 Answer
How to make ui only activate once 1 Answer