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
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
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.