Hello! Quick intro: this problem echoes in some of the threads but I was not able to find a solution or clear signal it’s impossible.
Is there a way to record with the Unity Recorder package and still use animators, particles, and tweens with unscaled time? We are working on a game with an active pause system, so our whole UI is built with unscaled time in mind. Everything works great until we want to record something more demanding like a 4k video. Despite some lags in the editor, everything in the game world is recorded perfectly - no issue here. But all animators, particles, and tweens with update mode set to unscaled time are speed up proportionally to the lag like here:
While I understand where it comes from (lag compensation from recording is probably taken into account when the engine is calculating regular time) I would love to know if we can do anything to make it fly with some of the elements being in UnscaledTime mode.
Running into this issue too. Any unity devs at Unity Recorder that can chime in and let us know if there’s any way to use the recorder to record things affected by Time.unscaledDeltaTime?
It does seem in fact that Unity Recorder adjusts the time scale to capture at the desired frame rate, but that means anything using unscaled time will not adjust accordingly.
Upon further testing, it seems like the Unity Recorder does not modify Time.timeScale, but it somehow magically modifies Time.deltaTime to account for constant framerate adjustment.
However, it does not affect Time.unscaledDeltaTime in the same way, hence causing the issue recorded above.
Short of an official fix, is there a way to know by which factor the recorder modifies the deltaTime so that we can ourselves multiply it with Time.unscaledDeltaTime?
What isn’t noted is that captureDeltaTime also has no effect on Time.unscaledDeltaTime! Meaning any animation or effect relying on that will not sync when capturing a movie.
The fix is easy but a little tedious. You want to replace any use of:
public static class TimeUtility
{
public static bool isCapturing => Time.captureFramerate > 0;
public static float unscaledDeltaTime => isCapturing ? Time.captureDeltaTime : Time.unscaledDeltaTime;
}
Fixing Time.unscaledTime is not as straightforward. There are two common cases for it:
Using it for user-input timings (e.g. did the user double-click within a time span), in which case you should not “fix” it to account for capture time scale, because these are human-perceptual timings
Using it for animations/effects, often by storing a start time, then calculating the difference from it. In those cases, you can change your approach to incrementing by the fixed unscaledDeltaTime at every animation frame.
That fix could also be generalized by having gllobal a capture-friendly unscaledTime counter that you update every frame in a singleton, then reference that everywhere else.