Scripts won't automatically update, always need to 'reset' them in the inspector for update

I’m running Unity v4.0.1 on Windows 7.

Is there any way to make my scripts automatically update when I save them in MonoDevelop?

They only seem to update in Unity when I either ‘reset’ them or move them to a different folder.


I know this is a really old post. But I had this problem. To fix it, all I had to do was go into the Edit → Preferences…

Once there, under the General Tab, I had to check the box for “Auto Refresh”. That was it. When I save it now updates live in the game. I don’t know why I ever unchecked that box. I hope this helps anyone who runs into this problem.

Assuming you don’t want them to show up in the inspector, you can make your variables private.

private int iVal; // C#
private var iVal : int; // Javascript

Variables in C# are private by default, but in Javascript they are public by default.

I was having the same problem, right-clicking in the project window and selecting “Sync Mono Develop Project” fixed it for me. I hope it helps.

I have same problem i dont find right-clicking in the project window and selecting “Sync Mono Develop Project” but i click on reset on panel opf script and script is updated.
I know is tedious but better of nothing…

The scripts will update unless you screwed up Unity in some way. However, how can you tell they don’t update? If you mean setting new default values for public variables then yes, they won’t change. The point of public variables is that you can change them in the inspector. If you initialize a variable in your script it will only use that value when the script-component is attached to an object or reset.

If you don’t want to set them in the inspector, don’t make them public like robertbu said. If you need them to be public to access them from another script but you don’t want it to get serialized by unity, add the System.NonSerialized attribute to your variable.

Thank you very much for the replies they’re much appreciated, but it seems I should have been more clear in my question. I understand that you cannot change the code using the inspector, that’s not what I’m trying to do.

Every time I save my script in MonoDevelop and then go to Unity to test the game it uses the previous version of the script without updating any new script changes I coded.

I can tell they don’t update until I reset because I can still see the previous version of my code in the Imported Object window of the Inspector when the script is selected in the project folder. Then when I click reset the code updates to match what I have in MonoDevelop.

If there’s no setting that could cause this then perhaps my Unity installation screwed up? It’s not something that can stop me from getting things done but it sure does get tiresome needing to reset every time I want to change some code.

try going to edit>preferences>external tools, uncheck editor attaching then check it back to on save exit project try it again see if it helps.

I had the same problem, its a unity ver 4.5/4.6 problem, shut down unity and restart it.

Found out: Visual Studio project Assembly-CSharp-Editor-vs does references Assembly-CSharp-vs, thus if Assembly-CSharp-vs changes, Visual Studio reloads it. This can happen at any moment and sometimes causes Unity to fail to move newly compiled Assembly-CSharp. No matter what you do, this state persists until you restart the Unity editor. At this moment Unity uses latest version of Assembly-CSharp it has in memory, thus your scripts seem to not recompile.

Unloading Assembly-CSharp-Editor-vs project in Visual Studio fixed this for me.

This might also happen in other IDEs.

SYNC MONO DEVELOP PROJECT… its Right click inspector… worked when weird CSG project didnt want to update in unity net3dbool to be precise isnt refreshing… dont know why, save a new code and can only see it in unity if i sync mono dev proj.

Sometimes you just have to make sure the script is just on “play” mode whilst writing the script.