Search Issue Tracker
By Design
Votes
1
Found in
2018.4.0f1
2019.1.0a1
2019.1.2f1
2019.2.0a1
2019.3.0a1
Issue ID
1153873
Regression
No
Mathf.Approximately on similar values do not return true in IL2CPP Standalone
How to reproduce:
1. Open attached project "mathf.approx bug.zip" and scene "Main"
2. Enter Play mode
3. In Game View, press "Begin" button (the "Begin" button changes to "Done", this is expected)
4. Build and Run the standalone with IL2CPP
5. In Standalone, press the "Begin" button
Expected result: the "Begin" button changes to "Done"
Actual result: the "Begin" button is stuck at "Lerping"
Reproducible with: 2018.3.14f1, 2018.4.0f1, 2019.1.3f1, 2019.2.0b2, 2019.3.0a2
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- XR Ray Interactor Cone Cast doesn't match Gizmo in Scene View when Cone Cast Angle is higher than 10 degrees
- [XR] LODs switch between high and low poly when Objects are near the center of the screen and switch when near the periphery vision
- Crash when trying to force Shader to interpret 1/30 as a floating point operation
- Terrain is flickering when adjusting "Compatibility Mode" and "Use Rendering Layers" Settings
- Isometric tiles are flickering and overlapping each other when entering Play Mode with Tilemap Renderer mode set to "Chunk"
Resolution Note:
Floating point behavior is different between Mono and IL2CPP. The problem with the example is this line:
f1 = Mathf.Lerp(startValue, endValue, 21.25f * (Time.time - startTime));
"startValue" should be "f1":
f1 = Mathf.Lerp(f1, endValue, 21.25f * (Time.time - startTime));
Without this change the Mathf.Lerp call is always the same and it results in a value that is not quite the same as the end value, probably due to roundoff errors, so the Approximately call will always return false.