Unusual invalid set index on base array error

Godot Version



When I try to edit a value in this array, the game crashes with an invalid set index on base array error.
This only happens if I create the array using a variable. If I create the value of the array manually it doesn’t crash. (The values are identical.) *I want to use variables to set the contents of the array.
I’ve tried changing it to different values of different variable types, it still crashes. Even setting the index equal to itself crashes. The index exists, and I’m able to get the value. This issue only affects one specific array and no others. What am I missing?

I’m not the best programmer, so I’m likely to be wrong here, but I think it’s because you instantiated an array of variables and not an array of integers. What happens when you do this:

var zero = 0
var one = 1
var array1 = [zero, one]
zero = 2

does it print (2, 1)?

No, changing the original variable doesn’t have an effect.

nvm, problem solved.

I have same problem, how it solved?