How could I build a spline and pass that to another BP?

Does anyone know how I could build a spline and pass that to another blueprint.

I have an blueprint actor and would like to pass in a spline as a path for it to follow. I tried creating an actor blueprint with a spline component as it’s root, but I can’t reference it from another blueprint.

Thoughts much appreciated…

You can have one blueprint use the spline in another blueprint but you have to figure out how you want to set it up.

Easiest way to do this, if you know exactly what you want at design time, is to create an Actor variable on your BP and set it to editable. You can then plug your BP with the spline component into that new Actor variable. Now you can easily reference the spline component on that plugged in actor. Here is an image of a quick version i made.

So on event begin play i use a timeline to move my blueprint along SplineActorTarget’s spline (my variable with the other blueprint plugged in).

This could be handled more gracefully but i made it really quick. I cast the splineActorTarget to my special splined blueprint so i can get the spline component (named Spline1). My Timeline float track (NewTrack0) goes from 0 to 1 over 5 seconds. I plug the track’s output into Time on a Get World Location at Time and use that location to set my actor location.

Any questions, just ask!

For sure! You just need to find a way to link your specific splined blueprint in. This comes down to how your project works. Since i don’t know much about your project I’m just gonna throw out some ideas and you can fire back at me any input!

  1. Whatever logic is spawning the new blueprint has a reference to the splined blueprint in the level and passes that into that SplineActorTarget variable. You will maybe need to set this up as a function like “SetSplineActor” so you can do any following logic in the new blueprint.

  2. When your new blueprint begins play it first does a get all actors by class of the splined blueprint class. It could check for a special tag or just use the first one it finds if you plan on having only one.

Hi ,

Thanks for this and your solution is almost exactly how I had envisioned doing this, but for some reason, If I create a variable of type ‘actor’ and make it editable, it states ‘editing this value is not allowed’. The only way of selecting the actor I want is to drag both BP’s into the scene outliner. I was trying to spawn my BP during the game, so I need to pre-populate the spline actor variable.

Any thoughts.

Resolved. Many thanks for your help.
I ended up changing the spline actor var to a class, spawn it on start and then grab a reference. Works fine.