Inspector Trumps code always...?

Is this a new feature or a bug?

If I write a public field, say it’s a float of 5. I click into Unity and the inspector updates. However if I immediately go back into the code and change it to a 6, the inspector stays as 5. Before I remember that if you CHANGED a variable in the inspector it would take priority, but now it seems that the values you initialize mean nothing anymore.

Someone have any insight on this? Should I file a bug? (And yes this is very similar behaviour as before, but different enough now to be incredibly annoying).

It’s most definitely not a bug. The value in code is a default value for newly created objects only, or for objects that did not have a value for the field serialized into them before.

Is this a new change? I don’t remember being forced to use the inspector exclusively (excluding using start/awake since you can’t see those values in the inspector).

Nope, not a new change. It’s always been like this. Change the variable itself and it won’t be :slight_smile: You’ll find if you reset the component via the cogwheel, it’ll change to the newly defined public variable value.

For whatever reason I don’t remember it being this annoying. Now I have to change all my numbers twice. Instead of just iterating over “in-code” values I have to change the numbers in the inspector until it’s where I want it and then go back and change it in the code as well.

? That doesn’t seem to make sense. Why would you have to change it in the code?

Currently I’m writing code for a default control behaviour. To fine tune it I’m tweaking the values in the Inspector but to make it the defaults for the component I have to change the code, as the values changed in the inspector only apply to that object/prefab.