Instanced mesh with BP class functionality?

I used this tutorial to create a system for spawning instanced meshes along a spline: Populating Meshes Along a Spline | Tips & Tricks | Unreal Engine - YouTube

It’s working perfectly as intended, but I want the spawned objects to be interactable (player can destroy them). I already have a BP for the object I want to spawn that handles all the interaction properly, but I’m stuck trying to adapt the spline BP to create instances of that BP instead of just a plain static mesh.

I tried changing the code to call SpawnActor with my specific class, instead of the AddInstance to InstancedStaticMesh as shown in the video, but it doesn’t spawn anything. Not sure if that’s because I’m running it in the construction script, which didn’t allow me to use SpawnActor directly (I wrapped it in a function).

Is there any way to manipulate InstancedStaticMesh component to use a special BP Actor class? Or some other way to spawn an Actor BP that fits with this mechanism?

Thanks!

If you want to spawn things, you need to do the whole thing in the event graph, and not construction.

Just cut and paste :slight_smile:

Thanks, doing it that way works!

Using the construction graph was nice because it would update as I edit the spline in the editor, although if I just do the Instanced Mesh version on the construction graph, then delete the Instanced Mesh component on BeginPlay, I can get the best of both worlds :slight_smile:

You can spawn from the CS, but you have to do it by calling a custom event in the event graph.

Problem is with spawning from the CS, is you have to keep tidying all the meshes, every time it runs :slight_smile: