Settin local variable by reference

I am trying to recursive loop throught nested maps, so i need to store the current map and if i find the correct place i want to insert my item, but it seems that the variables are created by value/copy of the map and not by reference (maybe im interpreting it wrong).

In the screenshots i first set the current map to the root map

in the second screenshot im adding to the current map, but the added item is only added to current and not to the original map (folders).

I also tried to use “set by ref” but that did not work.
I thought when i assign an object like a map to a variable its using the reference and not making a new copy of the map.

Hope you get what i mean, sounds like a silly question.

Hi, what you do is actually creating a copy of the map. So if you change one map, another is not changed. I don’t know any blueprint way to achieve what you need, in C++ you could have 2 shared pointers to a map.
Of course there can be some workarounds like use 1 object variable instead of local or some kind of wrapper, or maybe just change 2 maps - but I assume you can achieve it without help :slight_smile:

1 Like

Thats anoying to hear :roll_eyes: but i fixed it by using a wrapper object.
but in my eyes its a design flaw that you cannot mark certain stuff as handled as references.