C# - [HideInInspector] Bug?

Hi, I think there’s a bug when using [HideInInspector].

public Vector3 vMAP_SIZE = new Vector3(1000, 0, 1000);

This is my current code. I didn’t put [HideInInspector] in from the beginning, and changed the variable in the inspector previously. This overwrites the script declaration (as expected), but then when I THEN added [HideInInspector], the variable is still overwritten, but not editable and not visible!

Bug? Or am I using it wrong? I just want public variables without them messing up in the inspector, I only use the inspector for debugging anyway.

I had this problem too recently. The value set in the inspector overrides the value set in code. Then if you apply [HideInInspector], the inspector value remains set, but no longer editable.

This can cause huge confusion for young players. Ideally Unity could forcefully null the hidden inspector value so that the code value takes precedence if HideInInspector is used.