I have a crash when I generate a mesh from a spline using a custom BP node, it’s quite a simple mesh ( just an extrude from a spline shape ).
The dynamic mesh generated is saved in an asset automatically.
The crash happens way more often if you inspect the PCG graph ( spawn debug boxes on a node ) but it can occur also while editing the input data ( the spline which generates the mesh ).
I was able to narrow down the issue to just few nodes and packaged it in a project.
Thanks a lot for any insight / idea or best practices !
But I don’t see your attached project though… if you still have it lying around let me know!
For what it’s worth, from the callstack, it seems related to static mesh compilation / physics data.
I wonder if you could load the mesh separately prior to spawning it (and make sure to get it compiled), which would maybe be in a better place. It’s possible that it being in an ISM isn’t helpful.
Or alternatively, since these are piecewise things, maybe you could spawn a static mesh component and set the mesh on it directly instead of going through the Static Mesh Spawner.
I’ve attached the project to this message, let me know if you can see it ?
I’ll try to force load the mesh using a BP node.
As a matter of fact, I was not really a big fan of using ISM for a single mesh indeed But I could find any way to create a SM component and setting up the mesh to it as I need to pick up the mesh path from an attribute.
The only thing I could find was the AddComponent node, but I couldn’t set the mesh path from an attribute, only Template editing was available, any pointer on how can I do that ?
And a bit off topic, IMHO having a way to add any type component and being able to set any of their parameters using an attribute would be super really useful ( Like we alreay have on the StaticMeshSpanwer with the “Static Mesh Component Property Overrides” array ).
Hi again, thanks for the project, we’ll have a look next week.
As for setting the static mesh on the static mesh component, here’s how it could work in theory*.
Add component with Static Mesh Component, with the transform you’d give to that component
On the output you’ll notice that there’s a component reference attribute on the point data (“ComponentReference”).
Use that reference to pass into “Apply On Object” node (Object reference attribute-> ComponentReference)
Either add a mesh attribute on the point or use a simple Create Attribute w/ soft object path, pick a mesh.
On the Apply On Object node in the Property Override Descriptions, add an entry with Input Source "[Content removed] and Property Target -> “StaticMesh”.
… and this is where this goes wrong because it’s not the proper way to do it - unfortunately, you’ll get an ensure! We’d need to call the SetStaticMesh method with the specified mesh
I’ll talk with the team so there’s an horizon where we are able to call functions (at least with a single parameter) like this if possible, but that won’t be for a while (this means not in 5.6).
However, I still wanted to give you the full example because I’m sure you’ll find ways to use that for other nefarious purposes! It can allow you to change a lot of properties driven from points and so on.
■■■■ ! Thanks a lot, it indeed doesn’t fix the static mesh thing, but that “Apply On Object” node is exactly what I was looking for ! That indeed opens a lot of doors
Alright, so we’re having a look (we’ve reproduced the crash) - I think in the short term, there are two things that seem slightly bad in your case:
your path doesn’t seem valid
you’re not saving the package automatically.
you have the SM spawner using custom collision filter, but there’s no collision in practice on the mesh.
It seems like the ISMs do not like having meshes that aren’t saved/in a proper package, so you could probably not do this until we have a better idea/fix for it.
Thanks a lot, I indeed switch the auto save asset off as it helped a lot to have a near realtime feedback when the user tweak the shape of the building ( I generate quite a lot of meshes and instances ).
But actually, one of our engineer here just found a “workdaround more than a fix”, but it seems to not crash anymore, I attached a picture of the code.
We’ve submitted a fix in PCGAssetExporterUtils which wasn’t properly handling existing assets (CL 42428260 in UE5/Main). This fix will make it in to UE 5.6.
You should probably still be saving this asset as in your example project the asset ends up in the /Temp and will not be persisted, so I am not sure what will happen when you cook the game.
Thank a lot, we’ll check if we can cherry pick that
Actually, when I generate the PCG graph ( meshes and instances ), the generated mesh is in the “to save” list anyway, and when I save it ( manually ), it’s in the proper place. But I’ll keep in mind that I better should have this saving issue in mind in anything weird happen.