Search Unity

Question on Freezing and Resuming Time

Discussion in 'Scripting' started by DestinyAwaits, Nov 25, 2015.

  1. DestinyAwaits

    DestinyAwaits

    Joined:
    Jul 14, 2014
    Posts:
    3
    I have a question for you on something I've been stuck on. I've been trying to make it that when a popup(panel+text and button) appears, time in the game will freeze. Then I wanted to have it that when the button is clicked, time would resume. I tried using CancelInvoke("Timer") but that hasn't been working. Do you know how I could do it?

    timeScript C# Script:

    gameDictionaries C# Script:

    Basically I want to make it that it'll stop the timer from timeScript when gameDictionaries' makeProduct is called/used. Then when I go to say makeProduct2, I want time to resume. How would I do that?
     
  2. DeathQuake

    DeathQuake

    Joined:
    Oct 24, 2012
    Posts:
    64
  3. mikeymike

    mikeymike

    Joined:
    Oct 21, 2014
    Posts:
    35
    Code (csharp):
    1.  
    2. Time.timeScale = 0.0f;
    3.