I would like to change a simple value in an array at a specific position, but even if the value within the array is not 0, when trying to change the value, this becomes 0. This happens in a simple loop like:
for (int i = 0; i < 4; i++)
{
int stat = child[i]; // stat becomes 0 even if child[i] is != 0
// some calculation on stat here
}
I've used VS17 debugger to try to understand what it is exactly happening, but I still don't know why this happens. In my application I've already set other variables to elements in array, but this is the first time I've seen anything like that.
According to the debugger, stat = 0, even if child[i] != 0:
This happens thoughout all the loop. I'm sure that it is something that I'm missing, but I really can't get what it is.

statyou need to go to the next line to see the value afterwards.statin scope and has its value? There is no statement that exists in this state. By adding a Debog.Log statement, you introduce a statement that does have these properties (stat is in scope post assignment)