Crash when trying to "Update Mesh Section" on any procedural mesh just after "Clear Mesh Section" and "Create Mesh Section" for different vertices and triangles

I have already submitted this bug via the bug submission form just now, but to notifying this bug to UE4 users, I report it here.

  1. Create a new project. (Either BP project or C++ project will do.)
  2. Make an Actor and add Procedural Mesh Component.
  3. Make 2 sets of different numbers of vertices and triangles.
    For example,
    vertices1 … 101 vertices, triangles1…100 triangles
    vertices2 … 501 vertices, triangles2…500 triangles
    Here I made 2 circle meshes like the attached image.
  4. Create Mesh Section with vertices1 and triangles1.
  5. Make a function which swaps [vertices1 and triangles1] and [vertices2 and triangles2], like the attached image.
  6. Play and execute the above function once or several times.

It results in crash with the crash reporter.

It seems that when the both length of vertices1 and vertices2, and the length of triangles1 and triangles2 are the same, the editor does not crash.
And when “Delay” node is inserted between “Create Mesh Section” and “Update Mesh Section”, sometimes the editor does not crash.
So I think “Create Mesh Section” is completed when the memory reallocation for different size of vertices array or triangles array has not been completed.

I am changing the vertex positions of the procedural mesh on every frame (via “Create Mesh Section” of Event Tick), so “Update Mesh Section” is sometimes executed just after the “Create Mesh Section”.

I am so suffering from this bug.


Here is the crash report.
It also seems to say memory reallocation of the vertex buffer of the procedural mesh is something wrong.

Assertion failed: (void*)((&ElementData[VertexIndex]) + 1) <= (void*)(TangentsDataPtr + TangentsData->GetResourceSize()) [File:d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\engine\public\Rendering/StaticMeshVertexBuffer.h] [Line: 279]

UE4Editor_Core!FDebug::AssertFailed() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:419]
UE4Editor_ProceduralMeshComponent!FProceduralMeshSceneProxy::UpdateSection_RenderThread() [d:\build++ue4+release-4.19+compile\sync\engine\plugins\runtime\proceduralmeshcomponent\source\proceduralmeshcomponent\private\proceduralmeshcomponent.cpp:208]


We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.