|
Post by Ash Blue on May 1, 2017 23:16:35 GMT
I've discovered a bug in ProCamera2DRooms.cs that wipes out the entire camera randomly by setting the transform value to NaN (rendering nothing except the camera's background). I was noticing this when using the module with builds on super fast computers (i7 chips for example).
Line 426 runs the risk of dividing by zero. A lot of machines will bottom out and return a NaN in this case (iOS does not, but Windows will). If a system has zero latency on startup, `ProCamera2D.DeltaTime` will be zero and an instant transition with `transitionDuration` will also be zero. This bug is insanely hard to constantly reproduce without a top of the line system (spent the day finding the source of the bug's symptoms).
// Line 426 t += ProCamera2D.DeltaTime / transitionDuration; This doomsday bug can be easily avoided with a simple float point check on the delta time. As accidentally triggering a NaN error is never good for performance reasons.
// Prevent NaN error with float point checks if (transitionDuration < 0.001f) { t = 1.1f; } else if (ProCamera2D.DeltaTime > 0.0000001f) { t += ProCamera2D.DeltaTime / transitionDuration; } This bug is probably affecting anyone using the rooms module intermittently. Can this fix be put into the next release?
|
|
|
Post by Luís Pedro Fonseca on May 2, 2017 11:50:12 GMT
I've never ran into this issue and I have a very powerful system, so maybe it only happens on Windows?
Anyhow, what you said makes total sense and I can see why it would happen. Thanks for chasing this down, I bet it wasn't easy!
It will definitely be part of the next release.
Cheers!
|
|
|
Post by Ash Blue on May 2, 2017 12:19:00 GMT
Pretty sure the bug is exclusive to Windows. All the systems I reproduced it on were Windows 10 (haven't tried other versions).
|
|