From following script:
public void Awake()
{
var i = 0;
while (i < 1000000)
{
Debug.Log($"CurrTime: {Time.time:0.000000000000000000000000}. DeltaTime: {Time.deltaTime}");
i++;
}
}
All of which returned:
CurrTime: 0.000000000000000000000000. DeltaTime: 0.02
UnityEngine.Debug:Log(Object)
Even without formatting, it just returns “0”.
I could buy into explanation that deltaTime is based on framerate whilst Time is based on real time, but it permanently stuck at 0, even with this insane precision. I expected at least a nanosecond, or anything but 0. What happens?
I tried a delayed coroutine and it works:
public IEnumerator Yep()
{
var i = 0;
while (i < 10000)
{
Debug.Log($"{i} CurrTime: {Time.time:0.000000000000000000000000}. DeltaTime: {Time.deltaTime}");
yield return null;
i++;
}
}
My method needs Time.time to work and it cannot be invoked by Coroutine.
So, what gives?