public variable not updating (I use HideInspector)


I have a variable defined like this:

    public int stage = 0;

If I change the value, the scripts still read the value of 0. Is it a bug or I’m doing something wrong?

It sounds like the value is still getting serialized. HideInInspector simply prevents the field from appearing in the inspector. Unity still saves the value. Either show the variable in the inspector or use [System.NonSerialized] to prevent serialization.