So, public variables in Unity can get their values from one of two places. Firstly, from your script code, secondly from the editor inspector. The inspector is always assumed to be the "correct" source for the value. When you change the variable name, you're telling the inspector there is a completely new variable, and the inspector gets the value from the script. Since changing the name is annoying, just reset the inspector, and it'll re-read the values from the script. Alternatively if you want the values to always be read from the script and never the inspector, make the variables private.
↧