- Home /
Scripts compiling but not updating
I've run into a strange script problem. Recently the script compilation in Unity has started acting strangely. After making a change to any of my scripts, Unity compiles the scripts as usual with no warning or errors and all appears fine, however the change I made is not taking effect, as though Unity is still using the old version.
A simple test is commenting out a Debug.Log statement, but it's still appearing after saving and compiling the script and entering play mode. I am absolutely certain of the change I made and what I am seeing is not correct. If I quit and restart Unity then the script updates to the latest changes. It's pretty frustrating because now I have to quit Unity every time I make changes to my scripts.
Anyone know what could be causing this?
All my scripts are in C#. Using Unity Pro 4.3.4f1. It maybe related that I recently started working with a precompiled DLL, however the scripts in question are not related to that DLL.
Happens once in a while. This is what works for me:
Close any processes that work with your Unity project (Unity Editor, Visual Studio, git etc)
Go to the location of your Unity Project
Delete contents of the "Library" folder
Open the project again, wait for the "Library" folder to be rebuilt and you're done
I don't know if this is the same problem but here is the fix for it, its one $$anonymous$$ute fix https://youtu.be/2w6UrLv4KQM I hope this works for you.
Answer by Steven-Walker · Apr 17, 2014 at 05:08 PM
Oddly, this problem has resolved itself and I'm not sure how. I suspected the precompiled DLL may have been affecting the way Unity was compiling, so I removed it and all was working fine. After a day or so working like that, I have updated and reintegrated the DLL and am not having any issues updating the regular scripts. I do believe there is a bug somewhere in Unity, but it is obscure and not showing up again.
Has been happening to me as well with 4.6.0f1. Shutting down Unity entirely and restarting it resolves it for me, though the problem returns randomly.
Can you tell me how to solve it, i also find the problem.
Answer by Jarathor · Apr 03, 2015 at 06:57 PM
I expect this isn't happening to the original asker, but for absolute novices coming here: check to make sure you don't have the script open anywhere else (e.g., you've accidentally opened it twice in two instances of your IDE). I'm a decent scientific programmer but totally new to unity and I've fallen for this silly beginner's mistake before.
Answer by MFen · Apr 15, 2014 at 06:54 PM
Give this a try - Unity stopped compiling automatically
Thanks, but this isn't the same issue. $$anonymous$$y scripts are compiling when changed, but Unity seems to be holding onto an old cache of the compiled scripts. Just in case, I did try changing the meta files to be unhidden, but with no change in behavior of the scripts.
Can you tell me how to solve it, i also find the problem.
Answer by Karh · Mar 24, 2016 at 12:56 PM
I'm a beginner at Unity and I was having the same issue but I found a fix
After editing a script in Monodevelop and saving go back and left click on the script in Unity. Look at the code in the inspector, if your changes were not applied then right click on the script and select the last option "Synch MonoDevelop Project". This should update the script and it should execute properly when you test it.
I don't know how to make Unity auto update on it's own but this at least has been a manual fix for the problem for me.
Thanks, I don't see this option, but "open C# project" did the trick which was indeed the last option. (Unity 5.6)
Answer by Artisflowing · Nov 08, 2016 at 03:31 PM
Sometimes you just have to make sure the script is just on "play" mode whilst writing the script.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to import the object from server to unity 2 Answers
Material doesn't have a color property '_Color' 4 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer