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"

Get array element by ref example

Hi, I've noticed that in the new 4.16 version of UE there is 2 get nodes of array. One is as a copy and the other is as a reference. Could anyone please show me an example how to use the functionality that comes with get by ref.

Here is a screenshot that makes things more easy to explain what I'm needing: alt text


Product Version: UE 4.16
getref.png (68.3 kB)
more ▼

asked Jun 01 '17 at 02:39 PM in Blueprint Scripting

avatar image

203 10 22 25

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

1 answer: sort voted first

The difference as far as I know, is that in the 'copy' node, if you apply any changes to the corresponding element, it won't affect the element inside the array, while if you use the 'reference' node, any changes you apply to the element, will affect the original element inside the array as well.


more ▼

answered Jun 01 '17 at 04:04 PM

avatar image

1k 29 14 46

avatar image zaksi Jun 01 '17 at 04:17 PM

I get that, but I need a concrete example, where this is used - screenshot would be nice :) I don't know how to set up the nodes so I use this functionality. I know the theory behind it.

avatar image navid100 Jun 01 '17 at 06:18 PM

I don't have 4.16 installed, but this link should help you. Actually 'get by ref' was a feature request.



avatar image zaksi Jun 01 '17 at 06:37 PM

OK, so by what I gather from this is that this get by reference is only usefull if I have a struct that has an array in it? I can see how this would speed up a pipeline, but is there any other use for it? :)

What if I have single variable in my struct? It is somewhat cluncky to deal with the whole break the struct, then make a struct and reattach all of the variables that need to be the same, and just do some operations on that one variable that you want to change.

avatar image Harcarik Sep 07 '17 at 06:54 PM

If i want to match functionality of older UE versions, which of these two options i should choose? I am watching older tutorial where older version is used and i have no clue. Thanks

avatar image Olathuss Oct 17 '17 at 03:45 AM

According to: https://answers.unrealengine.com/questions/667140/get-a-ref-not-working-on-array-of-components-quali.html

You don't get a copy of the object, but rather a copy of the pointer which references the original. The node's descriptor is therefore misleading but accurate.

Unreal will automatically use the 'Get (a copy)' node when trying to use 'ref' node anyway.

Essentially, the array is storing pointers to the object and not the objects themselves. This way, the array is not modified itself (in other words, what it means is you can't change what the pointer is pointing to, but can modify the object in reference as normally).

If that was confusing; you can pretty much ignore the 'Get (by ref)' node and go with the copy version. [1]: /storage/temp/216887-copy-ref.png

copy-ref.png (24.6 kB)
(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