Hello everyone,
i have a very strange issue. I have a int array declared in my class. It looks like the following:
public int[] test = { 1, 2, 3, 4, 5, 6 };
So i can run the game and the array is properly initiated.
Now, if i close the game, change a value in the array, for example it looks like this now:
public int[] test = { 2, 2, 3, 4, 5, 6 };
I debug the game and look into the array and it still looks like this:
public int[] test = { 1, 2, 3, 4, 5, 6 };
So nothing has changed. I make sure that i was saving the file und rebuild it, but it is always the same outcome.
The only way i can fix this, is to comment this line out, start the game, stop it, uncomment it and then start it again. After this the change is been recognized. Don’t know what i’m doing wrong there, but this doesn’t seems to be a normal behaviour for me. Any idea?
EDIT
As addition i initialize this array outside of the Start() method.
Thanks!
Ah i see, that was exactly the issue. The values in the inspector are the old ones and they override my changes in the script, because they were not updated. I wasn't aware of this. Thank you for the hint!
– parkinson_projekt