Search Issue Tracker
By Design
Votes
0
Found in
2020.3.40f1
2021.3.9f1
2022.1.16f1
2022.2.0b8
2023.1.0a10
Issue ID
UUM-15821
Regression
No
mesh.SetVertexBufferData and mesh.SetIndices calculates bounds incorrectly when mesh.RecalculateBounds is not called
To reproduce:
1. Open the user’s project
2. Enter Play mode
3. Observe the Console
Expected result: Log “Center: (0.50, 0.50, 0.50), Extents: (0.50, 0.50, 0.50)”
Actual result: Log “Center: (0.00, 0.00, 0.00), Extents: (0.00, 0.00, 0.00)”
Reproducible with: 2020.3.40f1, 2021.3.9f1, 2022.1.16f1, 2022.2.0b8, 2023.1.0a10
Reproduced on: macOS Monterey 12.5.1 (Intel)
Workaround: Uncomment the line 71 “{{mesh.RecalculateBounds();”}} (RecalcutateBounds.cs)
Note: Reproducible in the Editor and in the Player
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note:
The bound recalculation is done for the submesh, not the mesh. Mesh.SetIndices takes the submesh in as a parameter. The result of the recalculation can be found on the bounds of that submesh; mesh.GetSubMesh(0).bounds in this case. When printing this to the console the expected value is observed.
We have a backlog item to smooth out the behavior around mesh bounds and submesh bounds. However, we have other higher priority work at the moment.
See also:
- https://issuetracker.unity3d.com/issues/bounds-are-not-applied-to-mesh-when-using-mesh-dot-applyanddisposewritablemeshdata
- https://docs.unity3d.com/ScriptReference/Rendering.MeshUpdateFlags.DontRecalculateBounds.html