Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Script changes don't compile

Discussion in 'Editor & General Support' started by justforunity, Aug 2, 2017.

  1. DbIMok

    DbIMok

    Joined:
    Sep 19, 2011
    Posts:
    23
    It looks like this is fixed in the version 2017.1.1f1?
     
  2. walkthisway12

    walkthisway12

    Joined:
    Nov 17, 2015
    Posts:
    2

    This fix has worked so far for me
     
  3. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    The fix has not landed in 2017.1 yet.

    The fix has landed in 2017.2.0b11
     
  4. arcmohudragon

    arcmohudragon

    Joined:
    Oct 15, 2012
    Posts:
    118
  5. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Unity 2017.2.0b11 has not been released yet.
     
  6. arcmohudragon

    arcmohudragon

    Joined:
    Oct 15, 2012
    Posts:
    118
    Oops, Thanks!
     
  7. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    17
    Hi Lukasz. I submitted bug report 948356 and am currently dealing with Ignas from QA.

    It seems like you're honing in on a solution but I wanted to make it clear that I have also suspected that ReSharper was to blame. I completely uninstalled ReSharper and have replicated the issue without it; with a clean, vanilla install of VS 2017 Enterprise.

    EDIT #1: I have also just completely unintalled VS 2017 Enterprise and installed vanilla VS 2017 Community. Issue persists.

    I will now install 2017.1.0f3 + DLL fix and see if that resolves the issue.

    EDIT #2: I tested the DLL fix with 2017.1.0f3. I can report that after over 50 consecutive compilation tests, the issue did not occur! Most of the time you'll see it after five or ten tests, so I'm quite sure this is fixed. Wahoo!
     
    Last edited: Sep 6, 2017
  8. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    492
    I still have the issue despite me rolling back to Unity 2017.1.0f3 and using your dll's. It seems to be much, much less frequent though. I am using ReSharper and VS 2017.

    To make it update again I have to write Debug.Log("Updated?"); and it often unblocks the script not compiling

    EDIT: I do have this error however:

    "Could not copy assembly from 'Temp\Assembly-CSharp-Editor.dll' to 'Library\ScriptAssemblies\Assembly-CSharp-Editor.dll'
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)"
     
    Last edited: Sep 6, 2017
  9. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Can you try this version of the Editor.dll? It includes some additional logging of exceptions. Could you share the exception output you get once the issue occurs?

    http://files.unity3d.com/lukasz/share/UnityEditorDLL-2017.1.0f3-ScriptCompileChange2.zip
     
    FeastSC2 likes this.
  10. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    The fix has now landed for 2017.1.1p2. Not yet released at the time of writing.
     
  11. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    492
    Last edited: Sep 7, 2017
  12. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    492
    This:

    IOException: Sharing violation on path
    System.IO.File.Replace (System.String sourceFileName, System.String destinationFileName, System.String destinationBackupFileName, Boolean ignoreMetadataErrors) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:434)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.MoveOrReplaceFile (System.String sourcePath, System.String destinationPath) (at /Users/lukasz/code/unity/2017.1/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:277)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)

    Then that:

    Could not copy assembly from 'Temp\Assembly-CSharp-Editor.dll' to 'Library\ScriptAssemblies\Assembly-CSharp-Editor.dll'
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)
     
  13. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    FeastSC2 likes this.
  14. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    492
    I still have the problem whenever I have my NAS software uploading my project files to my server.
    I will try without it for a while and let you know.
     
  15. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Do you also experienced this issue in 5.6 and earlier?
     
  16. Runwild

    Runwild

    Joined:
    Nov 23, 2016
    Posts:
    1
    I as so happy to find this, I was having this problem for weeks! It was very frustrating as I didn't know when it started, it shows no signs that anything has gone wrong as unity would detect a change and recompile as normal but the changes didn't have any effect.

    I tried everything, I removed Unity and VS and reinstalled both. We use SVN so I moved to a new directory. I tried installing patch releases as they were released.

    I noticed this started to happen at version 2017.1 p2 and it happened in p3, p4, and p5.

    The odd thing was that I was the only person in the office with this problem and we were all using the same repository and same version of Unity.

    The differences are I'm using Windows 7 and everyone else is using Windows 10 and I had installed ReSharper at some point but uninstalled shortly after.

    I installed Unity 2017.1.0f3 and tried the modified UnityEditor.dll fix (ScriptCompileChange2) and the problem stopped! I used it Thursday and Friday last week and didn't have the problem once.

    I do get a few of these errors in the console each time it compiles now:

    "IOException: Win32 IO returned ERROR_ALREADY_EXISTS. Path:
    System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:337)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.MoveOrReplaceFile (System.String sourcePath, System.String destinationPath) (at /Users/lukasz/code/unity/2017.1/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:261)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)"

    but it doesn't seem to matter and everything is working fine.
     
  17. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    492
    I experienced this before v2017 yes.
     
  18. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Then your issue is unrelated to the issue reported by others in this thread. The issue is that another app has the .dlls in Library/ScriptAssemblies open and we can therefore not replace them.

    There is not much be can do about this, as this behavior is a by design in the Windows file system. I think your best option is to avoid having any other software lock the files in Library/ScriptAssemblies, either by configuration or using alternative piece of software that does not lock the files. You could also report a bug to the developers of the software locking the files :)
     
    FeastSC2 likes this.
  19. maverikou

    maverikou

    Joined:
    May 25, 2016
    Posts:
    5
    Any news?
     
  20. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    I've updated the thread further above. But I will repeat here :)

    The fix has landed for 2017.1.1p2. Not yet released at the time of writing.
    The fix has landed for 2017.2.0b11.
     
    maverikou likes this.
  21. maverikou

    maverikou

    Joined:
    May 25, 2016
    Posts:
    5
    Thanks!
     
  22. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    66
    The fix (UnityEditorDLL-2017.1.0f3-ScriptCompileChange2.zip) didn't resolve the issue for me. It seems working fine on another project of mine tho (same Unity / Win7).
    When the bug happens, I cannot set a breakpoint since Visual studio 2017 shows the message: "The breakpoint will not currently be hit. Unable to find a corresponding location".
    I have to hit Reimport in Unity on my root script folder several times to fix it.
     
    Last edited: Sep 12, 2017
  23. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    492
    Great, I'll not upload the Library files anymore then, thanks.
     
  24. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Is this a new issue for you in Unity 2017.1? You could try deleting the Library/ScriptAssemblies and Library/UnityAssemblies (if you have it) and see if that fixes the issue.
     
  25. Jumbozo

    Jumbozo

    Joined:
    Feb 13, 2017
    Posts:
    2
    Just updated to unity 2017.1.1f1 and it looks like it reintroduced this bug - looking at your previous fix it doesnt look like it would work with the new version:

    "You can try the fix by downloading a modified UnityEditor.dll for Unity 2017.1.0f3 from here:"

    Any chance we could get a modified unityeditor.dll for 2017.1.1f1?

    Thanks!

    in the mean time i am going to try to replace the files anyway and revert if things go horribly wrong - i'll keep you posted

    Update: So far, running off the old fix((UnityEditorDLL-2017.1.0f3-ScriptCompileChange2.zip)) UnityEditor.dll for Unity 2017.1.0f3 is working on the newest version not sure if this will cause any problems though

    Second Update: Worked for 2-3 hours with the old fix with no noticeable problems
     
    Last edited: Sep 14, 2017
  26. mouurusai

    mouurusai

    Joined:
    Dec 2, 2011
    Posts:
    227
    lukaszunity, hello thank you for fix, it solve problem, but it broke player settings inspector.
    <<
    IndexOutOfRangeException: Array index is out of range.
    UnityEditor.PlayerSettingsEditor.CommonSettings () (at /Users/lukasz/code/unity/2017.1/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:568)
    UnityEditor.PlayerSettingsEditor.OnInspectorGUI () (at /Users/lukasz/code/unity/2017.1/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:505)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/lukasz/code/unity/2017.1/Editor/Mono/Inspector/InspectorWindow.cs:1240)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    >>
     
  27. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Unity 2017.1.1p2 which includes the fix should be available soon at https://unity3d.com/unity/qa/patch-releases, so I would rather just wait for the official release than to provide more custom built .dlls.

    This most likely happened because you used the .dlls with another version of Unity than 2017.1.0f3.
     
    mouurusai likes this.
  28. Jumbozo

    Jumbozo

    Joined:
    Feb 13, 2017
    Posts:
    2
    looks like the update is live for 2017.1.1p2 for anyone else looking
     
  29. arcmohudragon

    arcmohudragon

    Joined:
    Oct 15, 2012
    Posts:
    118
    Unity 2017.1.1p2, it seems to be fixed a compile bug for me.
     
  30. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    66
    Hi!
    I still have the issue (less often btw).
    Unity 2017.1.1.p2.

    It just keeps telling me at runtime: "UnassignedReferenceException: The variable (...) has not been assigned".
    That variable has the old name before I renamed it. (it's a Transform)
    This time the bug it's not due to script assemblies cause I deleted them, and compiled again (checked the modified date and it's ok)
    The component attached to gameobject in the scene shows the correct field and it's assigned.
    If I put a breakpoint in VisualStudio2017, I see that the field name is correct and correctly assigned.
     
    Last edited: Sep 25, 2017
  31. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Do you have a call stack for this exception? Can you explain the steps you take to make this happen?
     
  32. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    66
    The problem is fixed when deleting UnityAssemblies, closing editor and launched Unity again.
    The steps are normal variable renaming procedure under VS...(CTRL + .)
     
  33. OldRod

    OldRod

    Joined:
    Mar 2, 2009
    Posts:
    118
    2017.1.1p2 fixed the compiling problem for me. Thank you!
     
  34. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    66
    Did another 2 experiments:
    Restored not working UnityAssemblies and it works fine.
    Restored not working Project (I made a backup of that for debug purposes) and it works fine.
    It seems that closing and reopening the editor was enough in this case.
    I guess there's something not related to script assemblies this time...
     
  35. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    This is too little information to go on to figure what the issue is. More details about the exact steps are required to understand exactly what is causing the issue.

    Ideally you would report a bug through the Unity bug reporter with detailed steps, repro project and possibly a video showing exactly what happens for you. Then our QA will investigate the issue and assign it to the correct team
     
  36. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    66
    Ok, I'll try to do that when the issue will show again. I'm not able to reproduce it anymore since I closed the editor.
     
  37. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    66
    Happened again and I had to close and open unity to fix it.
    Really I can't understand why it happens, the only things I did were creating another class and set the old one as inherited. It's something to do with fields serialization and it's not reproducible intentionally.
    Is there any way I can collect more info so I can send it to you?
    thx

    UnassignedReferenceException: The variable AnimatedComponent of CharacterAvatarRacket has not been assigned.
    You probably need to assign the AnimatedComponent variable of the CharacterAvatarRacket script in the inspector.
    at (wrapper managed-to-native) UnityEngine.Component:GetComponentFastPath (System.Type,intptr)
    at UnityEngine.Component.GetComponent[Animation] () [0x00020] in C:\buildslave\unity\build\artifacts\generated\common\runtime\ComponentBindings.gen.cs:48
     
  38. Colorwen

    Colorwen

    Joined:
    Sep 26, 2017
    Posts:
    3
    Hi!
    I still have the issue
    Unity 2017.1.1.p2.
    upload_2017-9-26_17-47-33.png
    upload_2017-9-26_17-46-26.png
     
  39. BoarFrog

    BoarFrog

    Joined:
    Apr 26, 2014
    Posts:
    4
    I was one of the people having this issue from earlier parts of this thread. Haven't had it since the earlier fixes from Lukasz and eventual release of 2017.1.1p2. I don't envy anyone that is still having this issue! x_x
     
  40. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    The best thing for us to go on would be a the Editor.log after this happens and a video showing the exact steps you are taking, in order for us to reproduce it. If you could submit a bug with this info and share the case number here, then that would be great :)

    Do you also have this issue in Unity 5.6? Could you try the UnityEditorDLL-2017.1.0f3-ScriptCompileChange3.zip posted earlier in this thread (and repeated below) with Unity 2017.1.0f3 to see if this makes a difference for you?

     
  41. m0rr0ws0n

    m0rr0ws0n

    Joined:
    Sep 18, 2014
    Posts:
    55
    I'm having this issue too. I upgraded to 2017.1.1f1 and it worked fine for a little while then I noticed smartfox server wasn't getting the information I was trying to send. I checked it...it's not updating again.
     
  42. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    The fix is not in 2017.1.1f1. You need upgrade to 2017.1.1p2 or later. https://unity3d.com/unity/qa/patch-releases
     
  43. Colorwen

    Colorwen

    Joined:
    Sep 26, 2017
    Posts:
    3
    No,it happen when I upgraded from 5.6 to 2017.1.1p2. I try the UnityEditorDLL-2017.1.0f3-ScriptCompileChange3.zip,it didn't work .I also install 2017.1.1p3,still show the error...:( Maybe something is wrong with my computer...
     
  44. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Did you get any detailed errors with UnityEditorDLL-2017.1.0f3-ScriptCompileChange3.zip?
     
  45. enigma_lvn

    enigma_lvn

    Joined:
    Jul 14, 2016
    Posts:
    5
    Still having the issue on 2017.1.1f1
     
  46. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
  47. enigma_lvn

    enigma_lvn

    Joined:
    Jul 14, 2016
    Posts:
    5
    Sorry. Didnt see the previous answer.
    Is there any way to fix that on .1.1f1? Cus I cant really upgrade my project to another version of unity right now. I keep on deleting the assembly folder, but the problem keeps on reoccurring after a while.
     
  48. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    The patch releases are not really a version upgrade, but just patches on top of existing releases and should be safe to upgrade to. No fix will be provided for Unity 2017.1.1f1 and we recommend that users use the patch releases to address issues as soon as possible.
     
  49. TofaPT

    TofaPT

    Joined:
    Mar 5, 2015
    Posts:
    3
    I've seen similar symptoms to this in 2017.2.0f3 and I've located the cause in my case. It's an unusual case but I'll list it here in case it is of help to anyone else.

    Background: I was using Windows linked folders so that I could have most of a sizeable Unity project on a large HDD, but I was hard-linking the Library which was stored on a smaller SSD drive. This technique means you can get SSD benefits without having to use as much space on the SSD (if your projects are large) - you can even have the Library point to a RAM drive.

    This approach worked on 5.4 but it seems not on 2017.2.0f3 (I have not tested other inbetween versions).
    Using some test projects with a single object and script, I found:
    #1 With the entire Unity folder on one drive all is fine (as you'd expect)
    #2 With the Unity folder on one drive, but with Unity\Library hard linking to the same drive, this also worked fine
    #3 With the Unity folder on one drive, but with Unity\Library hard linking to another drive, this failed.

    The test was:
    A. Change the single script with a text editor (e.g. in Start() add Debug.Log("Time is XXX\n");
    B. Play the game and observe the message

    The failure in Test #3 was that the message that had been changed in A was not observed in B.


    By comparing the different cases, I noticed that in the fail case the compilation just 'ends' after a certain point.
    See below output as an example.


    ============================================================
    Refresh: detecting if any assets need to be imported or removed ...
    Hashing assets ... 0.000 seconds
    file open: 0.000 seconds (2 files)
    file read: 0.000 seconds (0.001 MB)
    hash: 0.000 seconds
    ----- Compute hash(es) for 1 asset(s).

    Refresh: elapses 0.070027 seconds
    Updating Assets/TestMonoBehaviour.cs - GUID: 0424853d51e53a941a3ff7eb02e4d5b4...
    done. [Time: 51.838284 ms]
    Refreshing native plugins compatible for Editor in 1.22 ms, found 4 plugins.
    Preloading 2 native plugins for Editor in 0.10 ms.

    ----- Total AssetImport time: 0.140754s, AssetImport time: 0.093762s, Asset hashing: 0.000487s [0.6 KB, 1.157139 mb/s]

    - Starting compile Library/ScriptAssemblies/Assembly-CSharp.dll
    - Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
    Symbols will be read from Temp\Assembly-CSharp.dll.mdb
    Script Module: Assembly-CSharp.dll
    Pass: 0 took 3 milliseconds
    Pass: 1 took 0 milliseconds

    ###
    ### This doesn't progress further than here, the next lines output would
    ### normally be the ones below but in this case the compilation just ends
    ###

    Reloading assemblies after finishing script compilation.
    Begin MonoManager ReloadAssembly
    Refreshing native plugins compatible for Editor in 0.41 ms, found 4 plugins.
    Preloading 2 native plugins for Editor in 0.13 ms.
    Mono: successfully reloaded assembly
    Refreshing native plugins compatible for Editor in 0.59 ms, found 4 plugins.
    Preloading 2 native plugins for Editor in 0.09 ms.

    ----- Total AssetImport time: 0.063539s, AssetImport time: 0.000000s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]

    - Completed reload, in 1.010 seconds
    Initializing Unity.PackageManager (PackageManager) v2017.2.0 for Unity v2017.2.0f3
    Registering platform support modules:
    Registered platform support modules in: 0.0349232s.
    Native extension for Facebook target not found
    Native extension for WindowsStandalone target not found

    ============================================================
     
    Last edited: Oct 21, 2017
  50. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Thanks for taking the time to provide all the details for this issue. We will look into it.