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
- Frame spike due to many TreeRenderer.TreeUpdated calls when repositioning terrains in large Scenes
- Crash on GameObject::RemoveComponentFromGameObjectInternal when reparenting Text GameObjects
- [IL2CPP-GarbageCollector] Changing GCMode might permanently disable GC in a multithreaded context
- Crash on invalid_parameter_internal when starting Standalone Profiler
- VFX Graph tooltips have a double line on the bottom side
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).