How to use spline that is located in another blueprint?

i need to use spline which is located in another blueprint. How can I do that? I m trying to do that using cast to but cast to doesnt work as i want.

You need to provide more info. Are the objects placed in the level or spawned dynamically? Which blueprint is trying to communicate with one another?

Generally speaking, you need to obtain a reference to your object first, casting is not always necessary.

I have a blueprint (default pawn class) that is controlled by the player and it is moving ahead. Also i have another BP (pawn) that is placed in the level in the same position as starting place of the player and inside it has splines that i want to use to move my main character. You said that i need to obtain a reference to my first object. how can i do that?

Unfortunately i can only create a reference on level blueprint but not in my character blueprint. How can i do that inside my character?

Since you’ve put your Pawn in the level manually, open the LevelBlueprint and drag the reference to the graph. Here’s some detailed step by step:

Does it help?

To cast you first need to have the reference of this pawn.

Here is a helpful page:
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/FindingActors/Blueprints/index.html

You can also have something like a seperate “Spline Manager” that you will add references to when spawning those spline-pawns, and then have it expose functions that do whataver you need to do with them, achieving nice Seperation Of Concerns.

You might try using a “Get All Actors of Class” in your pawn. You can search for your spline blueprint and find the right one to get your spline variable out of. (It’s messy, but if there’s only one in the level, just get index 0 out of the result of Get All Actors of Class)