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:
![](https://static.packt-cdn.com/products/9781783550777/graphics/image_06_008.png)
In the Inspector
pane, under the Source Image
field, select the resetBtn2
Sprite type:
![](https://static.packt-cdn.com/products/9781783550777/graphics/image_06_009.png)
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:
![](https://static.packt-cdn.com/products/9781783550777/graphics/image_06_010.png)
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:
![](https://static.packt-cdn.com/products/9781783550777/graphics/image_06_011.png)
Once positioned, it should look like the following in the game:
![](https://static.packt-cdn.com/products/9781783550777/graphics/image_06_012.png)
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...