Search Issue Tracker
By Design
By Design in 2023.1.X
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
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
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
Resolution Note (2023.1.X):
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