Hi,
in my game I’m trying to determine how much time has passed since the start of the level. Time.timeSinceLevelLoad
seemed to be the perfect built-in candidate for this. However, when tried using it, it simply did not reset at the loading of the level!
As this seems to be a pretty basic feature, I’m wondering if any of the below is causing this behaviour:
-
I’m in Editor (that is, not a build)
-
I’m reloading the same scene, not a different one
-
I’m using additive scenes and there is a secondary scene that never gets unloaded (but it’s not the active scene)
I suspect that the reason is this last one, that if not all the scenes are changed, the timer isn’t reset, but I was wondering: does someone know what exactly causes this behaviour? Is this a bug in Unity?
UPDATE: I’ve made a minimal project to test the issue, and it is certainly present (see [121801-timesincelevelstarttest.zip|121801]). Additionally, I tested that it does not happen if the scene is just normally reloaded.
BTW, I’m on Unity 2018.2.0f2.
(Note: I don’t need help in a workaround, I’ve already set up my own counter for this purpose that works perfectly. I would just like to know what is going on exactly, and possibly document an unusual/buggy behaviour of the Unity API).