Unity not applying inspector values

I feel like I’m losing my fricking mind! I have a bunch of variables in the inspector marked as [SerializeField] private so I can change them in engine but some of them, seemingly at randomly don’t get applied at runtime. What’s worse is the way to fix it is pause the runtime, click on a random inspector variable from the script, press enter (you don’t even have to change it!) and the values get applied! I tried restarting the engine, my computer but nothing fixes this! I’m using Unity 2022.1.23f1.

Does anyone know what the hell is going on?

I have about 30 values editable in the inspector in that script, is that what could be causing it?

Serialised values on any component will not get applied during runtime. Unity has always worked that way.

Scriptable Object values will persist however, as they are assets and don’t live in any particular scene.

That’s not what I meant. For example I can have a variable called Jump that is set to 10 in the inspector. I then press play and the Debug Log states Jump is 10, the inspector says Jump is 10 but in reality, in game Jump is something less. Only when I pause the runtime, click on the Jump value in the inspector, I don’t even change it, I just press enter, THEN it get’s applied as 10 in game. What’s so confusing is that for it to be applied I don’t even have to click on and press enter on the Jump variable in the inspector! It can be any from that script!

Well either that’s an enormous bug on Unity’s part, or you have some sort of bug on your end (such as something else changing the value unexpectedly).

If you are able to reliably reproduce it in a standalone project, make a bug report.