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
- ArgumentOutOfRangeException when manipulating the Project Settings search bar
- [Linux] Touch freezes in Player when any mouse button is clicked
- UnityEngine.Rendering.Volume.OnEnable() is called twice before OnDisable() creating multiple copies of the same volume when a volume is enabled right after Domain Reload when entering Play Mode
- Hinge Joint transforms are reset when toggling the "useMotor" property
- Motion Vector texture reports incorrect Mesh data when Mesh is coming from off-screen
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).