Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Figured since you're studying programming that seeing the solution I did might be interesting.
Here's a snippet from that code (C#)

Basically, I just have a bool set to true if the player has finished.
If they have, I just don't Allow the player to reset.
Your solution was a good idea, this does basically the same thing.
But instead of disabling the button I disable a part of the function.

        if (hasFinished == true)
        {
            Invoke("SelectWinner", 0f);
        }
        else
        {
            //Reset the timer
            if (Input.GetButtonDown("P1_ResetToStart") || Input.GetKeyDown(KeyCode.Q))
            {
                currentTime = 0f;
            }
        }