Search Issue Tracker

By Design

Votes

0

Found in

2017.4.12f1

Issue ID

1084597

Regression

No

Time.captureFramerate is broken for values less than 90

Input

-

Time.captureFramerate is returning incorrect values. The attached project contains the following test:

[Test]
public void CaptureFramerate_WhenSet_MakesDeltaTimeConstant([Values(1, 10, 30, 60, 90, 72)] int rate)
{
Time.captureFramerate = rate;
Assert.That(Time.deltaTime, Is.EqualTo(1f / rate).Within(0.01f));
}

And it is returning the following results;

For a value of 60

CaptureFramerate_WhenSet_MakesDeltaTimeConstant(60) (0.017s)
---
Expected: 0.0166666675f +/- 0.00999999978f
But was: 0.0333333351f

For a value of 30:

CaptureFramerate_WhenSet_MakesDeltaTimeConstant(30) (0.017s)
---
Expected: 0.0333333351f +/- 0.00999999978f
But was: 0.100000001f

10:

CaptureFramerate_WhenSet_MakesDeltaTimeConstant(10) (0.020s)
---
Expected: 0.100000001f +/- 0.00999999978f
But was: 1.0f

1:

CaptureFramerate_WhenSet_MakesDeltaTimeConstant(1) (0.035s)
---
Expected: 1.0f +/- 0.00999999978f
But was: 0.0166480541f

This case is similar to https://fogbugz.unity3d.com/f/cases/1084575/ but it appears to be broken in a different way (this was found when trying to find where care 1084575 broke)

Comments (1)

  1. hueda

    Oct 19, 2018 06:26

    ME TO!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.