Accessing a Blueprint, attached to a Blueprint... inside another blueprint

Have come over from Unity and working on an Unreal project. Below is the Blueprint setup.

image

I wanted to originally have BP_Circle_UI inside the Greasing Point blueprint. But both have static meshes in them and I need to position the Circle Ui. So I have attached inside the parent Blueprint instead. I can move it around easily enough now.
But how can BP_Greasing_Point reference the child BP_Circle_UI? Keeping in mind there is potentially going to be several of these combinations.
I can see the overall parent BP having references to these and passing references… but this seems really messy. I could also do a call to get all classes of type, and they have a number system to distinguish. But this seems even worse and a nightmare to debug.

OR should I be trying to implement this in a different way? Happy to provide more explanations and screen shots if needed.

Thanks in advance!

Most of the time there’s at least two solutions in game development :wink:
Honestly, if I see nested child actors, I would probably think about some other solution.

However, answering your question, there’s this node which seems to handle your case (when Include Descendants is ticked)
Get All Child Actors | Unreal Engine Documentation

Also, I’m not sure if it works, but child actors basically spawns an actor and attaches it to a blueprint, so you can try to call GetAttachedActors in Greasing Point as well

1 Like

Many solutions exist here, some better than others - depending on how extensive this system is to become, and who needs to talk to whom:

  • you can use the actor that owns both components to make them talk to one another, and that’s without even creating additional references - use an Event Dispatcher. Assuming the Greasing Point needs to update its UI:

image

image

Dispatchers can carry any data, ofc.


Another way:

  • the UI actor could reach out to the Parent Actor and communicate with any other components present there:


And that’s before we even starting taking advantage of inheritance, or, better - in case there are some unrelated classes present - Blueprint Interface. This would eliminate casting and a lot of ambiguity.


Honestly, if I see nested child actors, I would probably think about some other solution.

Hard to disagree.

@ExpanseVR1 must these elements be full actors? Perhaps it’d be enough to override some components. For example:

Now you have a widget component with a graph (because you want to run some logic that’s unfit for regular widget perhaps?).

image

You’ve now stripped a wrapping layer and could talk to this custom comp directly. You can still equip it with an interface to make the comms even more snappy. Perhaps the greasing point does not need to be a fully fledged actor either…

1 Like

Thanks for that. Yeah, I can think of so many more elegant ways I would go about achieving this same scenario in Unity. Sometimes Im not sure if its not being uses to the engine, or just my brain fighting against a different way of doing things.

Re: Get All Child Actors
This seems to only work for within the Blueprint itself, not when attached to the Blueprint inside the other one.

Thanks for the detailed reply. Given me some good ideas to work with.

In the case of the UI, its actually a VR project and its a static mesh. But I see where you are going and I could just make an override of the static mesh BP and add the minimal logic to that.

I do like the Dispatchers approach too. I have used them before so this seems like a simple solution. Will have a go today and see what I come up with :slight_smile:

Thanks again!

1 Like