How do I get a reference to a child actor?

I have a child actor on my character blueprint and I want to reference a function in this child actor in my character animation blueprint, how should I do that?
3333

As shown in the picture, I feel that the method I used is wrong

The Get All Child Actors node will return all children in an array. If the first item of the array (0) is the weapontrace instead of the BP_weapon your code will fail. You should be able to simply drag from the Cast To FP → As FP and get the BP_Weapon if it is a public variable or class / asset.

To test, simply change the current GET from 0 to 1 and see if it starts working.

Hi there @europa-12. Hope you’re well!

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

That’s a “ChildActorComponent” rather than a Child Actor, but you can reference it directly as you’re casting it to a “FP” class which I assume is what the first snapshot is from?

1 Like

Thank you so much! Yes, after I printed both 0 and 1, 1 didn’t seem to print anything, luckily there is only BPweapon in it

Really thank you so much! I tried to get bpweapon from fp but after that I got confused, so that’s how the nodes are connected! Thank you !

1 Like

Thanks for the correction, and you too~

1 Like

No worries, I am glad to help! I hope everything goes well for you! :slight_smile: