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
- Spot Light with 'Box' Shape stops working when it collides with Mesh
- Accepting Asset Store EULA endless loop in Package Manager window
- “InvalidOperationException: Sequence contains no matching element“ error when reenabling a custom Debug Draw Mode
- Prefab that contains a layout group is marked as changed by the Editor when opened
- Emission animation does not appear when the "Emission Map" parameter is set to black in a Lit material
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