Search Issue Tracker
By Design
By Design in 2023.1.X
Votes
0
Found in
2020.3.40f1
2021.3.11f1
2022.1.20f1
2022.2.0b11
2023.1.0a14
Issue ID
UUM-19273
Regression
No
Incorrect float to int conversion when using Explicit Typecasting
Reproduction steps:
- Open the attached project (“FloatToIntBug.zip“)
- Open the Scene “Assets/Scenes/SampleScene“
- Enter the Play Mode
- Observe Console Window
Expected result: Multiplication 28300*0.04 is equal to 1132
Actual result: The shown answer is 1131
Reproducible with: 2020.3.40f1, 2021.3.11f1, 2022.1.20f1, 2022.2.0b11, 2023.1.0a14
Reproducible on: Windows 11
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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
This behavior matches existing .Net Framework 4.8 behavior. There is a compiler change that injects a cast to float in .Net 6+ prior to performing multiplication with a float which prevents the truncation that is observed.
Resolution Note (2023.1.X):
This behavior matches existing .Net Framework 4.8 behavior. There is a compiler change that injects a cast to float in .Net 6+ prior to performing multiplication with a float which prevents the truncation that is observed.