Find the parent of an attached actor in the level

I’m trying to do something that seems incredibly simple, but I’m not having much luck. In my level I have the following hierarchy:

image

BP_Vertex is attached to BP_Puzzle. In the Construction Script of BP_Vertex, I want to get a reference to it’s “parent” in the level. So the actor it is attached to, BP_Puzzle in this case.

How exactly can I find BP_Puzzle_02? None of these actually return it, so I’m kind of lost.

This one

It’s returning the actor, so if you want to do BP_Puzzle_02 things with it, you have to cast first…

That also seemed like the most logical option, but I still got errors when trying to cast to it BP_Puzzle unfortunately :woman_shrugging:

image

BP_Vertex Construction:

Log:

Would you have any idea why it’s failing the cast?

Construction Script is more than likely called before it is attached to the parent. Check where your attachment takes place, try calling Get Attach Parent Actor 1 tick after BeginPlay.

Yeah you’re right, seems to work fine when I actually run it on BeginPlay.

That solves that issue, thanks :+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.