I have it set where in the gameDictionaries script it is calling stoptimer from timeScript in the makeProduct method. Then in the stopProduct method, I have it where it calls starttimer from the timeScript. gameDictionaries: Code (CSharp): public void makeProduct(string message) { makeButton.gameObject.SetActive (true); makePanel.SetActive (true); make2button.gameObject.SetActive(true); totalDev.gameObject.SetActive(true); totalDev.GetComponent<Text>().text = "Total Development Cost: $" + totalMake.ToString(); GetComponent<timeScript>().StopTimer() } Code (CSharp): public void stopProduct() { print (gameName); if (pickedsystem == "Develop for:") { } else { makeButton.gameObject.SetActive(false); makePanel.SetActive(false); } GetComponent<timeScript>().StartTimer(); } } timeScript: Code (CSharp): public void StartTimer() { InvokeRepeating("TimerFunction", 0, 1); } public void StopTimer() { CancelInvoke("TimerFunction"); Time.timeScale = 0f; } Code (CSharp): void Start() { InvokeRepeating("Timer", 0, 1); } How do I get time to unfreeze?
Use a Coroutine, wait the amount of time using unscaled time: Code (csharp): IEnumerator WaitForRealSeconds(float dur) { float start = Time.unscaledTime; while(Time.unscaledTime - start < dur) yield return null; }
Is this for time freezing or unfreezing? Code (CSharp): StartCoroutine(WaitForRealSeconds(time)); Is this a valid way of using this Coroutine?