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
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
- [RenderingDebugger][InputSystemPackage] Ctrl+Backspace shortcut doesn't work to open the Rendering Debugger when New Input System is in use
- No option to skip video transcoding when launching a Project
- “ValidateSchema Error2” error is thrown in the Player when using IL2CPP Scripting Backend
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.