Set group of object visible from an input

Hey guys! I’m pretty new to blueprints in Unreal Engine, and I am having difficulties with making something pretty simple. I want a set of object to simply appear when right clicking. However, i don’t know how to get the reference of my set of object in the character controller. How should I take on this problem? Here is what I tried to do:


If you need the controlled character to appear its Get Controlled Pawn and just pin it to target you don’t even need to do a cast, but if you need to make some other object to appear you need a reference to it, you can get it through the blueprint you spawned it from or do TraceByChanel or an overlap.

I need to make some other object to appear, so I need to do the function in the BP that I am gonna spawn right?

By “set of objects” do you mean some actors you’ve placed in the level? You want to right click and show them all in one go?

Again you need a reference the usual way to get it from the BP that spawns the object.

I need to make some other object to
appear, so I need to do the function
in the BP that I am gonna spawn right?

Do you already have the objects in the level or do you want to spawn new objects? So far you’ve mentioned both - the solution will be quite different in both cases.

The set of Object can be there Beforehand or spawn - but they are kinda heavy (Approx 50 entities)

Yes exactly!

Wow, very good answer, exactly what i was looking for. Thanks and cheers! :slight_smile:

Wether you’re spawning the actors from BP or placed them in the level beforehand, I’d treat it the same in your case.

You’ll need something to distinguish which objects should be toggled and which should not. If they all share a distinct class (like you have some “ActorToBeToggled” class and all of them and only them should be toggled, that’d be perfect). Then you can just use the GetAllActorsOfClass node, loop through them with a ForEachLoop, draw a GetRootComponent from it and toggle the visibility as you already did.

If they don’t share a class but are a group of distinct classes, you’d be best to make an Interface that each of your classes inherits and then use a GetAllActorsWithInterface.

If they are completely random and you want to choose, I’d probably use Tags. You can set a Tag on any Actor you placed in the world in its Actor category in the details panel, or you can set them through blueprint if you want to spawn them through blueprint. Then you can use GetAllActorsWithTag node.

Each of these would be totally viable in the player controller BP.

Hope that this helps!
Cheers :smiley: