x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to Get an Array of Actors by Their Copies?

Normally when we make arrays of actors we are actually making references to those actors in blueprints, but how to do it if I`d like to make an array of actors by their copies instead of references?

Product Version: UE 4.21
Tags:
more ▼

asked Nov 30 '18 at 10:49 AM in Blueprint Scripting

avatar image

ANoobyBird
47 4 4 10

avatar image Tuerer Nov 30 '18 at 11:00 AM

I've found a nice explanation here: https://www.reddit.com/r/unrealengine/comments/7kp75c/what_does_get_a_copy_in_blueprints_really_mean/
In short, you can't get copies of actors. Even if you use Get Copy, you still get the Reference.

avatar image ANoobyBird Nov 30 '18 at 11:47 AM

Thank you :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

You have to loop through the array, spawn new actors with the same attributes as the current ones, and store these in a new array. As a result, you should have a new array with the "copy" of your existing actors.

more ▼

answered Nov 30 '18 at 12:29 PM

avatar image

KristofMorva
1.4k 5 5 7

avatar image ANoobyBird Dec 01 '18 at 03:09 PM

Thank you :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I think you might use the "Get all actors from class" node if ou are using blueprints, basically it returns an array of all the actors of a given class to the node, either by a drop down menu or node imput that can come from a variable and sort, here's some documentation on it. https://docs.unrealengine.com/en-us/Gameplay/HowTo/FindingActors/Blueprints Hope this helps (=

more ▼

answered Nov 30 '18 at 12:36 PM

avatar image

alefaso
12 2 1 4

avatar image ANoobyBird Dec 01 '18 at 03:09 PM

Thank you :)

avatar image KristofMorva Dec 01 '18 at 03:31 PM

Just keep in mind, that function is really slow, so if you can, avoid that.

avatar image ANoobyBird Dec 02 '18 at 11:56 AM

But what if I am to save an array of actors with a lot of variables in a save game object, and since each one of them comes with lots of variables I don`t really want to save those variables` values one by one but instead save all of them as actors, however the array of actors is actually pointers, then the issue is that the actors couldn`t really be properly loaded and spawned at the beginning of the game, which is proven by a little test I did. Any convenient way to fix this instead of going over all the variables of the actors?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question