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
- Build fails when building a project containing an 18+ dimension array with IL2CPP
- [Android][Sentis] Human poses are not detected when using the BlazePose model
- Sprite Editor Outline Tool Overlay is not displayed when no Sprite is selected
- “No method with RuntimeInitializeOnLoadMethod attribute” warning from ReadmeEditor.cs is thrown after installing Project Auditor Rules
- Projection matrix is altered when using RasterCommandBuffer.ClearRenderTarget on DX12 and Metal
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