Public variable in script doesn't update in Unity inspector when saved

I’m new to Unity and am trying to build a very basic script. I have a property in a game control script like so:

public float objectSpeed =0.1f;

If I save this script and attach it to an empty game control object, I can now see the script attached in the inspector showing the property, which is called Object Speed:

31665-unity.jpg

But if I change the value of objectSpeed in the script and save the script, it doesn’t update the value in the inspector in Unity, meaning that when my script runs, it picks up the value from within Unity, and not the updated value in the actual script.

I’ve tried saving the script, restarting Mono and Unity, and the original value never changes. However if I remove and re-attach the game control script to the game control object, the value now successfully updates in the Unity inspector.

I’m not sure what is going on here and this has caused me some confusion. Is this a bug or am I doing something daft? I’m using Unity version 4.5.2f1.

If it was already attached in scene or on prefab, the serialized value originally in the inspector gets saved. If you want to reset the component to the script default values, click the little cog(gear) and reset the component.