Search Issue Tracker
Not Reproducible
Votes
0
Found in
2019.2
Issue ID
1245263
Regression
No
[Mesh] Crash in Mesh.SetSubMeshImpl
MeshDataBindings::SetSubMeshImpl -> UpdateSharedDataSubMeshVertexRange
GetVertexBufferRange(::GetSubMeshBuffer32(submesh, &data), submesh.indexCount, submesh.firstVertex, lastVertex);
first parameter is null, so we have a crash inside GetVertexBufferRange
Cannot reproduce it with old SetTriangles API.
Sidenote: inside MeshScripting::InternalSetIndexBufferData
Sometimes
Mesh::IndexContainer& buffer = m->GetWritableIndexBuffer();
if (meshBufferStartBytes + countBytes > buffer.size())
{
*outException = Scripting::CreateArgumentException("Accessing %zu bytes at offset %zu for mesh index buffer of size %zu bytes is not possible.", countBytes, meshBufferStartBytes, buffer.size());
return;
}
buffer.capacity() is correct, but buffer.size() is less than capacity for unknown reason.
--------
STEPS:
1) Open attached project
2) Open the scene file inside
3) Click on the sphere and make sure DebugTestChange's changeMaterial is enabled and list of materials is not empty
HexasphereMaterialData.UseNewMeshAPI = false -- has expected behavior
HexasphereMaterialData.UseNewMeshAPI = true -- some hexes will disappear, then hard crash of Unity Editor on access violation
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (2020.2.X):
The gotcha is, that changing mesh.subMeshCount to a smaller value than it was before will also resize the index buffer. In some cases during your script run, what used to be 3 submeshes changes to two, and the index buffer size effectively is reduced to what was the previous two submeshes (336).