Updating array's that have been passed by reference

If I pass an array by reference via an interface and then later modify the array in it’s original place, shouldn’t the array that I passed also update?

I am finding that this is not the case.

No it should not.

I’m not sure if you’re fluent in c or c++. Basically what your passing is a normal variable. It’s merely a copy of the variable you passed. What you want is a pointer. However there is (as far as I know) no direct way of doing that in blueprint.

You will have to provide the actor reference to get this behavior. If you have the whole actor and set / get the array directly from it you are modifying the original array.

I hope this helps.


Yeah I’m fluent in both - but in C# you CAN pass a list to another class and then modify that collection in either place and they’ll ‘both’ update - because it’s just one thing that you’re referencing.

If this is still passing by value, what does the checkbox for ‘pass as reference’ do?

ah, yes, not fluent in ‘c’.

In C#, just like in Java, you pass objects by reference not by value (like in c/c++), you have to use pointer to achieve this effect.

Yes but again, why then does it have a parameter that’s called ‘pass by reference’? what does that do? I would assume it passes something by reference but it does not.

Additionally, how can I pass a pointer to an array in blueprints?

Are you sure Erasio? I use the pass-by-reference to replicate increment++ constructors found in programming. As shown below.