I’m having a strange problem with timing in only certain scenes of my build. For instance, in my Loading scene, I use the following simple method for controlling my countdown:
void Update ()
{
timer += Time.deltaTime;
if (timer >= timeToWait)
{
Application.LoadLevel ("MainMenu");
}
}
This works fine in the Inspector and when I compile a build and run it on my development machine. However, when I move it to my production machine, it counts down very quickly; probably hitting 0 after about two or three seconds.
In another scene, I “blink” some text by looping the alpha value in a method called from Update:
function UpdateTextAlpha()
{
// Fade font in proper direction.
if (c.a >= 1)
{
fontFadeIn = false;
}
if (c.a <= 0)
{
fontFadeIn = true;
}
if (fontFadeIn == true)
{
c.a += Time.deltaTime;
}
else
{
c.a -= Time.deltaTime;
}
}
Again, this is fine in the Inspector and when running a build on my development machine; however, on the production machine, it is way too fast.
On the other hand, I use the first method in other scenes, and the countdown is perfect. Any idea where I’m going wrong? Thanks.
Update: I tried copying my entire scene to a new project and testing just that scene. The countdown timer runs fine when I do that.