Set Array Elem sets all other indexes to 0

I have a Problem with this funktion.
With this funktion i want to increase and decrease an Int Value of an Array for an Index given as Input. for that i first load my savegame to get acces to my Int Array. Then is take the Int of the Index given as Input. When it is <10 it increase the Value, when it is >0 it decrease the Value. Then i Save these new values to the Index given as Input.

The Problem is instead of editing just the Value of the Index, this function edit the Value AND reset all other indices to 0. How can i fix it? So it just edit the Value and doesnot reset all the other indices.

Thank you in advance

Array don’t have does not have explicit index and it’s related to how it is stored and managed in memory. Array stores data in chain, one element after another and what is called “Index” is not some assignable number but native offset of array memory address where element is stored, a address in the chain of data. When you delete element of array, the element is removed and all elements before it is moved back in memory to fill the empty space, effectively changing all the indexes of elements before deleted elements. If you set element of array in specific index it set value on specific position of memory, so if you set same value on different index you create a copy.

So if you use array, you should not depend on index positioning as elements may change index during variues operations, but you are 100% sure that elements are filled between 0 and ArraySize-1 indexes

If you want explicit settable indexes, you should use Map instead, int int map. In Map data is stored as key/value pairs which each can have any type, and key is functions as index, changes in the map as well as order they are stored in memory don’t effect the pair so index of element won’t change and you freely to set both key (the index) and value on the go.

from earlier c# learning i know it diffrint there the index cant change.
and i dont know why should they change in my case i dont add or remove indexes. Then the following videos have to be wrong or not. I am completly confused

Better?

the green line coming into the picture are the Index coming from the Input of the function

If you could rearrange the connections in the bp not to overlap each other and show the entire function chain in one single screenshot, that would be helpful.

I fixed the issue by creating a temp array which is a copy of the original Array. this Array doesnot have any default indexes. First i copy the original array into the temp array then i edit the temp array and copy the edited temp array into the original array. and thats it.

i hope this helps all who have a similar problem