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
- Errors "InvalidOperationException: Trying to use a texture (_InternalGradingLut)..." and “Render Graph Execution error” shown and Scene turns black when 16 or more Render Objects are used
- GameObjects in the Game View are rendered differently than in the Scene View when the Rendering Path is set to "Deferred" and Screen Space Shadows Renderer Feature is added
- Errors “InvalidOperationException: Trying to use a texture (_CameraDepthTexture)...” and “Render Graph Execution error” shown when selecting GameObjects with Mesh Renderer from the Hierarchy
- macOS stutters in a minimal project
- [Usability] HDRP Wizard calls for VR fixes when opening the HDRP Wizard a second time after they have already been applied and the Wizard has finished checking
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).