Alright, i have my level up system set up so that it will pause the game (by setting Time.timeScale to 0), tell a GUI to display itself (by throwing a boolean switch). The problem is, i want to fade the GUI into view using GUI.color.a. Typically i would go about it by using Time.deltaTime, yet that has been disabled so that i could pause my game. So what is the best way to handle this.
I too wanted all kinds of things to work while my time scale was paused. The way i fixed it was to just pause the scripts and leave time running. It was pretty easy to do. I just used MonoBehaviour to create an array that held scripts and with a simple boole they can be enabled or disabled.
(ie)
var sriptToToggle : MonoBehaviour[];
//Then
for(var s in sriptToToggle)
s.enabled = true;
![]()
Use something like .000001 for the timescale instead of 0, and multiply Time.deltaTime by Time.timeScale.
–Eric
You could just track a delta time of your own using Time.realtimeSinceStartup, which keeps running when the game is paused.
float lastUpdateTime = 0f;
float myDelta = 0f;
void onGUI(){
if(lastUpdateTime != 0){
myDeltaTime = Time.realtimeSinceStartup - lastUpdateTime;
}
lastUpdateTime = Time.realtimeSinceStartup;
}