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
- Getting a deprecated package for JetBrains Rider pop up when opening or creating a project
- [Android] Volume level of the same audio file is different on Samsung Galaxy Tab A8 between 2023.3.0b3 and 2023.3.0b4
- ‘Expected end of value’ warning occurs when a property declaration includes five or more variable references
- Crash on BurstCompilerService::CompileAsync when entering Play mode in a specific scene
- InvalidOperationException when using Game Camera Preview in Scene window with a custom RenderGraph pass
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