Adding a game restart button in the startScene
Now create a new button in the startScene and rename the button to resetBtn
as shown in the following screenshot:
In the Inspector
pane, under the Source Image
field, select the resetBtn2
Sprite type:
Leave the rest of the parameters as they are. You will also see a preview of the reset button in the Inspector
pane along with its dimensions:
Position the button so that it is just under and to the right of the GAMEOVER!!!
text. By this we will make it accessible to the player's thumb:
Once positioned, it should look like the following in the game:
Now we have to create a small script so that, when the button is clicked, the startScene
is called. To do this, create a new script, call it buttonClick
, and save it in the Scripts
folder. Inside the script add the following lines:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class buttonClick : MonoBehaviour...