I am trying to get the children from a child actor component, from within that child actor component itself.
I want to store all these splines in an array in the child actor component.
I am able to get the children that are inside the child actor, but not the ones that are below it in the main blueprint.
How could I make this work?
Maybe you can try using Get Children Component, like so and list all descendents.
You can test if you’re getting the right output by printing the contents of the array to a string.
If you want to select a particular bone, you can note down the index of that particular bone
This way I can get the children that are IN the child actor itself, but not the components that are children of the child actor, but outside of it. It’s a really messy situation hahaha
The image is an example of how my hierarchy is.
GP = grabpoint (Child Actor) (These are preset positions where the gun can be grabbed.)
SP = spline
When I use “get children components” it returns me the meshes.
I somehow need to get a reference to self as a scene component object reference.
@anonymous_user_97a6aae81’s answer seems to be on point:
This would return all Text Renders attached to fingers.
Is this blueprint in the NewBlueprint or in the ChildActor?
This blueprint IS the NewBlueprint1. Child Actor is a component in that blueprint. A child actor can own another actor. It seems that in this setup the Child Actor has nothing to do with the splines apart from creating a hierarchical dependency.
If the goal is to fetch the splines below, the above applies. You’d want to Get Children Component
of Left Fingers
= those 5 splines.
If I am misunderstanding what is needed, do tell.
I am trying to get the children from a child actor component, from within that child actor component itself.
Hold on, does it mean that it’s the actor the Child Actor Component is holding onto needs to get those splines?
I think I might have found a workaround that is better.
It’s a difficult thing to explain, sorry for all the confusion
I wanted all the code to be in the Child Actor, not the parent blueprint.
When I used “Get Children Components” in the Child Actor, I could only get the components that are within that child actor itself, not the ones that are below it in the parent blueprint.
To work around it I’ll make a parent class that finds all the correct grabpoints and the splines underneath it, then passes all those splines on to the grabpoints themselve.
I get it now, your explanation was clear from the get-go - it’s just a somewhat uncommon scenario. Are we adding / removing the splines run-time? Or they’re always the same?
Fixed scenario, the splines and grabpoints will remain unchanged during gameplay.
In the child actor:
Assuming the actor that holds the CAC is the NewBlueprint1. If you need more flexibility and no casting, then this can be done via an Interface.
I still need to filter out the correct grabpoint, right now I get every grabpoint from the parent.
With this chain of casts I can already get all the spline meshes in the gun blueprint, this is very promising!
I realize that I’m doing way too much casts here, whoops, it’s getting late!
Why use the root? Use the direct parent of the splines. And if you need a specific component of the CAC’s parent:
You can also play with those:
Ha. I still feel like I’m missing a critical bit in this puzzle
I’ll be using these GrabPoints in multiple different weapons, so the hierarchy wont be the same everywhere.
Here I’m casting to the parent class of the weapon, and from there I’m getting all the grabpoints and trying to filter out itself. This way I should be able to add the grabpoints in any weapon in my project and it getting the splines that are under it.
(I tried adding the splines to the child actors themselve, but then I couldnt edit them in the weapon anymore)
I’d then immediately switch to an Interface. Send the request to the actor owning the CAC and it will return what is needed. Each weapon class can return something different. But Tags can work OK, too.
I’ll look into those, thank you!
I also stumbled accross this problem and I think a found an easy solution. You can do a “get parent component” from within the child actor which gives you the child actor component in the parent actor. From this, you can “get children components”