Values in inner array resets after leaves set function

Hello, this is my first time posting here, so please let me know if I’m doing something wrong.

Scenario:
I’m learning UE4 as I’m trying to make a tile map. From what I saw, I’m aware that BP doesn’t have a default matrix and I could use a single vector do that, but I decided to create my own Matrix class (based on object) with the following SetElement function.

Data is just an array of a structure with list of integers.

102527-intlinst.png

Problem:
Right after I set the elements within the integer array, the element goes back to the default value (0). Map is a variable of the type defined above. The print function only shows 0s, but When I’m debugging the flow goes through the set value 1. as well. I’m aware of the concept of pass by reference and value, but I don’t think thats the case here.

So, I’ve managed to make it work, but I had to to my IntList a blueprint from object instead of using a structure for it. If anyone know a better way to do it, please let me know.