How can I call functions of a Child Actor Component?

I have tow actor blueprint classes Cube and Shape with some functions.When i added Cube into Shape,Cube changed to a child actor component of Shape.Now,how can I call functions of Cube in Shape’s blueprint?

You have to get the child actor, and cast to it to its class, like this:

You could also cast it on begin play or somewhere, and promote it to a variable, then you won’t have to cast it every time you want to access it.

4 Likes

Why i cannot do this casting?

You are casting the child actor component, but you have to use Get Child Actor first, like in my screenshot above. Since it’s the actor you want to cast, not the component itself.

jesus, what is a “Do Something” node or an “Operate” node?!!?

those are just functions/events the people created in their actors

For anyone else who lands here, and faces the same frustration I did, pay a lot of attention to the chain that is “Component Name” → “Target Child Actor” → “Cast To BlueprintType”
Once you have that in your blueprint, functions on the Blueprint Type become available as nodes on the blueprint

How to you “get child actor” in the blue print above? I have a TextRender component and I have no way of casting that component to something. All I want to do is to call a function in that component.

237776-casting.png

I was struggling on this as well. Found out that if you drag your child component and from the pin search for Child Actor, this exact node will appear.

1 Like

Thanks for a reply. In this case however, “Child Actor” is a component type or component name in this blueprint? In my case, I added a component which is my own blueprint. Thanks.

Here is the answer:

How did you get that “cast to” node instead of flow-based one?

Right click on the node and at the bottom of the menu click “Convert to pure cast”.

That in-between distinction of using “Get Child Actor” from the Child Actor Component’s getter is exactly what I needed! Works like a charm, thanks a bunch, Mosel3y!

could it be more cryptic,wtf ???