Unity Crashs When Time.timescale = 0
link textHi, guys, I have put Time.timescale to 0 in a condition and when I start the game everything is normal but when the condition is met and time.timescale=0 unity engine stops responding and I can't press anything that means I can't interact with the inspector or play the game or pause it or stopping it or anything I can't-do anything , so the only thing that I can do is to force close unity because I cant close it, and lose my progress so can anybody help me because I am following a tutorial and I am stuck at this point and thanks .
[Here is th script] using UnityEngine;
namespace MAMF { public class Game_Manager_Toggle_Pause : MonoBehaviour { private Game_Manager_Master Game_Manager; private bool IsPaused;
void Start()
{
INI();
Game_Manager.MenuTriggerEvent += ToggleMenu;
Game_Manager.InvertoryUiToggleEvent += ToggleMenu;
}
void OnDisable()
{
Game_Manager.MenuTriggerEvent -= ToggleMenu;
Game_Manager.InvertoryUiToggleEvent -= ToggleMenu;
}
void INI()
{
Game_Manager = GetComponent<Game_Manager_Master>();
}
void ToggleMenu()
{
if (IsPaused == true)
{
Time.timeScale = 1;
IsPaused = false;
}
else if (IsPaused == false)
{
Time.timeScale = 0.0001f;
IsPaused = true;
}
}
}
}
[The Script file is below to download ]
Your answer
Follow this Question
Related Questions
When I open my Ingame Menu My mouse appears Then when I click it disappears 0 Answers
unity3d 5 game on fullscreen shows only half of game screen 4 Answers
error CS0201 1 Answer
GetSpectrumData Why last element in array allways is zero? 0 Answers
[2D] Getting the y coordinate of the top of a game object 0 Answers