Search Issue Tracker

Won't Fix



Found in




Issue ID




[M1] Incorrect calculation of values using multiplication with Mathf.Sqrt() when an unused variable is declared



How to reproduce:
1. Open the user attached "M1 Issue Repo" project
2. Open the "SampleScene" Scene
3. Enter Play Mode

Expected result: "nonZeroValue = 8.660254" is logged
Actual result: "nonZeroValue = 0" is logged

Reproducible with: 2020.1.0a4, 2020.3.33f1
Not Reproducible with: 2019.4.38f1, 2020.1.0a3, 2021.3.1f1, 2022.1.0f1, 2022.2.0a11

- Reproducible on a new project
- Not reproducible on non-Silicon macOS and Windows
- Switching to Debug Mode and entering Play Mode shows the correct values

  1. Resolution Note (2020.3.X):

    After investigation it was determined that this issue was fixed by the mono upgrade starting in version 2021.2 and backporting the required changes to 2020.3 would be non-trivial. The issue only reproduces in the editor and not during a mac standalone player runtime. It is also easy to work-around by performing the Sqrt function on a separate line than the multiplication. While this isn't ideal it will have to suffice to bridge the gap to where this issue is fixed in later versions. Additionally the defining of an unused variable appears to not be required to reproduce the bug.

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.