# Values in inner array resets after leaves set function

**URL:** <https://forums.unrealengine.com/t/values-in-inner-array-resets-after-leaves-set-function/366884>\
**Category:** Blueprint\
**Tags:** matrix, unreal-engine, Blueprint, question\
**Created:** [August 11, 2016, 9:41pm UTC](https://forums.unrealengine.com/t/values-in-inner-array-resets-after-leaves-set-function/366884 "2016-08-11T21:41:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![talislincoln](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@talislincoln](https://forums.unrealengine.com/u/talislincoln)\
**Post date:** [August 11, 2016, 9:41pm UTC](https://forums.unrealengine.com/t/values-in-inner-array-resets-after-leaves-set-function/366884/1 "2016-08-11T21:41:33Z")

</div>

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.

 ![102526-matrix.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/4/244bc799c44fc2e8aa327a157fb77157eb9a7ab4.png)

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

![102527-intlinst.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/a/a4aa9bcef74f44c1873fa314f35129893b6ba971.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.

 ![102528-log.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/6/9b6167b49aad6ecb176b3ca2bdb98ce75c093625.png)

---

<div class="post-metadata">

**Author:** ![talislincoln](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@talislincoln](https://forums.unrealengine.com/u/talislincoln)\
**Post date:** [August 11, 2016, 10:43pm UTC](https://forums.unrealengine.com/t/values-in-inner-array-resets-after-leaves-set-function/366884/2 "2016-08-11T22:43:53Z")

</div>

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.
