Child actor component - get parent blueprint object

Hi there!

So I love the child actor component system in UE4 4.7, but there is a bit of wonkiness in it. It’s a little clunky for getting child actor components and accessing their variables through the parent’s event graph, but doable. One issue I’m having, however, is that I can’t really do the reverse very dependably.

For example, I have a battleship with a bunch of weakpoint blueprint objects attached as child actor components. Each weakpoint in itself takes 5 shots to destroy and then, once destroyed, takes a chunk out of the battleship’s health by firing its “Take damage” function. The thing is, only one of my weakpoints is doing this functionality the right way. Every single other weakpoint ignores the part about delivering damage to the battleship. The way it works is that, on event begin play, every weakpoint tries to get its specific parent battleship object by using the blueprint node “get overlapping actors.” Through some debugging work, I noticed that only one of my battleship’s weakpoints gets the reference to the parent battleship, and all others return null.

Is there a better way of getting that reference? Should I be reconsidering using child actor components?

Same question here.

Do you have a picture of your event begin play? Yes you could rethink using child actor components, they can be band-aid-y at times but why not just use one weakpoint, find the parent, then promote it to a var/create a reference to it and then use that for setting the other 4.

Set the owner ( if spawning ) otherwise it’ll return null and use Get Owner when you want to retrieve the actor reference.

67435-screen+shot+2015-11-20+at+2.36.15+am.png

You want to “Get Attach Parent” of the root component of the actor that will be the child. This will give you a component reference to the Child Actor Component in the parent actor (in this case the battleship). Then “Get Owner” from that, which will give you an actor reference to the parent (battleship). Then cast that to your battleship blueprint so you can call its functions or do whatever. It sounds complicated when I write it out, but it’s actually really simple.

1 Like

This worked for me, thanks for sharing!

What worked for me was a 0.2 Delay and “Get Attach Parent Actor”