Hey there! I’ve got a huge amount of actors (avout 300) that should act as targets. Is there a way to group them? Or do I have to connect each actor as once?
They should be connected to Set Enable Gravity and Add Local Rotation as Targets in Blueprint …
Thank you! Is there an example how to create an array?
Targets for what? Group them in game or in editor? Connect to what?
Connect each as once?
What exactly are you trying to do?
You can get all actors of one type by using the “get all actors from class” node.
You can tag them and select all actors with that tag.
Our you can insert specific actors into an array on spawn and use that array for targets.
Then adding them to an array when created, as suggested by Erasio below, is probably the best way to go.
Searching Unreal Engine 5.2 Documentation | Unreal Engine 5.2 Documentation for “blueprint array” gives a lot of interesting links, such as:
Ok thanks … Now I create a new Variable/Array. The type should by Actor or Static Mesh Actor … But I can’t edit/add the elements … Why? ‘Editing this value is not allowed’ …
You cannot edit the elements until the blueprint has been compiled.
Aside from that, a more important question is where your 300 actors come from. Are they manually placed in the level, or are they automatically generated? If it’s the former, you could get a populated array using the GetAllActorsOfClass method (assuming of course that your actors are of some specific class you have created for this purpose). If it’s the latter, you could add each actor to your empty array when they are spawned.
It doesn’t even work when it is compiled. The Actors are manually placed in the level. They are based on the same static mesh. How can I add a class to these actors?
Or how can I do that with tags?
this is what I’ve got, but it ain’t working …
Well you are asking if the current BP had that tag.
Add your weapon reference to the “has tag” node as well and you should be fine.
But with this method you can also create a boolean variable which is editable. Like that you can easily click one box for the objects you want rather than adding a tag for each.
I connected “has tag” and weapon reference … still not working …
Could there something be wrong with the weapon reference? I just created an actor variable, is this correct or has there to be something special in it?
The tagged elements are StaticMeshActors.
because … if reference is ONE actor it works, but can’t get it working for ALL actors with the tag … how do I have to create a reference that targets ALL actors with tag?