Get Components by Class or by Tag: no referencing
The array that you get as output of the nodes "Get Components by Tag" or "Get Components by Class" is bugged. You are supposed to be able to use get with a reference or with a copy by choice. However, those arrays only allow getting "by copy". If you then press rightclick on the output of the get node to change the output mode to "reference", the description text while hovering above the get node is still saying that it's a copy you are getting. When you then once again press rightclick on the output, the option to change the output into a reference is greyed out.
Here is a picture and a gif to shocase the problem https://gyazo.com/8260cf7e14e43ac6ac159588f5eb6517
asked Jun 14 '17 at 02:23 PM in Bug Reports
Maybe a bit late on this, but anyway.
I'm not entirely familiar with the internal workings of the TArray in Blueprint, but what I do know applies to managed, object oriented programming: it shouldn't matter.
Why is this? Because objects in C++ are commonly stored somewhere in RAM. All you have to access them is a so-called pointer. A pointer is nothing but a numeric address. You dereference these pointers to access the object behind them. Accordingly you can have various pointers to the same memory address.
This is what's happening here. The object is somewhere in RAM (managed by UE4's garbage collector, it's address may even change at runtime), and the array merely contains numeric values that are interpreted as pointers to objects of a certain class. If you get a copy of such a pointer, you still change the actual object. If you were to get a reference of such a pointer, you'd be allowed to "rewrite" the numeric address of the pointer, effectively making it point to a different object.
As you can probably imagine, the latter is a rather uncommon use-case. So for most uses, it really shouldn't matter.
answered Jan 10 '18 at 01:47 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here