Return output variable by reference for getter

I have an array named Inventory of a class called BP_Inventory which inherits from Object. If I access it directly, removing from it works as expected, but if I wrap the array in a get function, it seems to create a copy and remove from the copy, leaving the original array unchanged.

I refactored the whole thing already from a Struct to an Object because I thought the struct might give the BP trouble but neither works as I would expect them to.

Am I doing something wrong here or is this expected behavior? If it is expected I would suggest a checkbox to pass by reference like you already implemented for inputs.

247619-capture.png

247618-capture-2.png

I would love to have something like the following for getter and setter:

247620-capture-3.png

247631-capture-4-getter.png

247632-capture-5-setter.png

You could activate checkboxes to override the standard getter and/or setter in the variables properties. When you activate those checkboxes the custom getter/setter icons appear and you could add custom behavior. This way you could always access the properties of any BP directly without the need to create dozens of getter and setter functions in the function area of the blueprints beforehand.

1 Like