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

  1. 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

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.