Search Issue Tracker
By Design
Votes
0
Found in
2022.3.43f1
6000.0.16f1
Issue ID
UUM-78466
Regression
No
Crash on Mesh::RecalculateNormals when calling Mesh.RecalculateNormals on a malformed mesh
Steps to reproduce:
1. Open the “user’s attached project”
2. Select the “TerrainGenerator” GameObject through the Hierarchy
3. Press the “Generate” button under the “Terrain Generator 3” component through the Inspector
4. Observe the crash
Reproducible with versions: 2022.3.43f1, 6000.0.16f1
Couldn’t test with versions: 2021.3.43f1 (due to compiler errors)
Reproducible on: macOS 14.5 (Intel), Windows 11 (by the reporter)
Not reproducible on: no other environment tested
Notes:
- Crash does not occur after commenting out line 119 in {{Generation3.cs}}
First few lines of StackTrace:
{noformat}0x00007ff79cbd6422 (Unity) Mesh::RecalculateNormals
0x00007ff79a5f8444 (Unity) Mesh_CUSTOM_RecalculateNormalsImpl
0x00000238914a032c (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Mesh:RecalculateNormalsImpl (UnityEngine.Mesh,UnityEngine.Rendering.MeshUpdateFlags)
0x00000238914a01f3 (Mono JIT Code) UnityEngine.Mesh:RecalculateNormals (UnityEngine.Rendering.MeshUpdateFlags)
0x00000238914a016b (Mono JIT Code) UnityEngine.Mesh:RecalculateNormals (){noformat}
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
- Channel remapping dropdown in the Terrain Layer does not open when clicked on the title
- The Editor freezes indefinitely when a large number of elements are entered in the Subgraphs or Categories lists
- Some Visual Effects package Assets links to documentation are not working
- Heatmap asset’s documentation button in the Inspector window leads to “Sorry... that page seems to be missing!” page when clicked
- Crash on MonoBehaviour::CallMethodIfAvailable when performing various actions
Resolution Note:
Validation is explicitly turned off in the code. MeshUpdateFlags.DontValidateIndices is provided to Mesh.SetSubMesh & Mesh.ApplyAndDisposeWritableMeshData. This will skip validation and can result in a crash when invalid data is provided. An ArgumentException is thrown when validation is enabled. More importantly, the project does not crash.
https://docs.unity3d.com/ScriptReference/Rendering.MeshUpdateFlags.DontValidateIndices.html