Skip to content

Commit 0969c42

Browse files
committed
Time: use unsaled (delta) time for recording
1 parent 733772c commit 0969c42

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Runtime/Scripts/GameRecorder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void Start()
138138
_videoEncoder = new VideoEncoder(_outputWidth, _outputHeight, FrameRate, RecordingDuration, outputDirectory, MirrorVertically);
139139

140140
_captureInterval = 1.0f / FrameRate;
141-
_nextCaptureTime = Time.time;
141+
_nextCaptureTime = Time.unscaledTime;
142142
}
143143

144144
void OnDestroy()
@@ -231,7 +231,7 @@ private IEnumerator CaptureFrames()
231231
{
232232
yield return new WaitForEndOfFrame();
233233

234-
if (Time.time >= _nextCaptureTime)
234+
if (Time.unscaledTime >= _nextCaptureTime)
235235
{
236236
_nextCaptureTime += _captureInterval;
237237

Runtime/Scripts/PerformanceSampler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ void Update()
4545
{
4646
if (isSampling)
4747
{
48-
sampleTimer += Time.deltaTime;
49-
durationTimer += Time.deltaTime;
48+
sampleTimer += Time.unscaledDeltaTime;
49+
durationTimer += Time.unscaledDeltaTime;
5050

5151
if (sampleTimer >= sampleFrequency)
5252
{
@@ -75,14 +75,14 @@ void CollectSample()
7575
{
7676
PerformanceSample sample = new PerformanceSample
7777
{
78-
timestamp = Time.time,
78+
timestamp = Time.unscaledTime,
7979
totalAllocatedMemory = Profiler.GetTotalAllocatedMemoryLong(),
8080
totalReservedMemory = Profiler.GetTotalReservedMemoryLong(),
8181
totalUnusedReservedMemory = Profiler.GetTotalUnusedReservedMemoryLong(),
8282
monoHeapSize = Profiler.GetMonoHeapSizeLong(),
8383
monoUsedSize = Profiler.GetMonoUsedSizeLong(),
8484
allocatedMemoryForGraphicsDriver = Profiler.GetAllocatedMemoryForGraphicsDriver(),
85-
frameTime = Time.deltaTime,
85+
frameTime = Time.unscaledDeltaTime,
8686
cpuUsage = GetCPUUsage()
8787
};
8888
samples.Add(sample);

0 commit comments

Comments
 (0)