Hello,
I am making a game in which you have to catch things which fall out of the sky. I have a timer, and when that timer is equal to 0, a scene with the score you achieved is being displayed. This works perfectly fine. In the scene where the score is being displayed, I have a restart button.
How can I make it, that when I press the restart button, the scorevalue in the game is resetted to 0?
Thanks in advance!
if its a seperate scene won’t the scorevalue be reset to 0 anyways?
You did not provide a lot information about your strucure, but a solution would be to create a GameManager as a singleton that manage the begining of your game.
From this point you could:
a) make a method that always reset all your game variable and then start the falling things game
b) The reset button could call this gameManager to reset the var.
https://unity3d.com/fr/learn/tutorials/projects/2d-roguelike-tutorial/writing-game-manager
Check the instance part and DontDestroyOnLoad() to prevent duplication