Search Unity

Unity fails to load outdated project

Discussion in 'Scripting' started by Qbit86, Nov 30, 2018.

  1. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    After updating project from Unity 5.5.0 to 2017.4.16 all scripts on every gameobject of starting scene became broken displaying “The associated script can not be loaded”: http://prntscr.com/lp0f6s

    There are no errors in Visual Studio, but a couple of errors in Editor.log:
    Code (csharp):
    1. System.InvalidOperationException: Operation is not valid due to the current state of the object.
    2.   at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader) [0x0002f] in <a3989f8c34e6476eaca56644d5639ee8>:0
    3.   at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x0004a] in <a3989f8c34e6476eaca56644d5639ee8>:0
    4.   at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <a3989f8c34e6476eaca56644d5639ee8>:0
    5.   at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <a3989f8c34e6476eaca56644d5639ee8>:0
    6.   at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <a3989f8c34e6476eaca56644d5639ee8>:0
    7.   at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <a3989f8c34e6476eaca56644d5639ee8>:0
    8.   at AssemblyUpdater.Core.AssemblyUpdaterContext.ReadAssembly (System.String assemblyPath, APIUpdater.Framework.Log.IAPIUpdaterListener listener, System.IO.FileAccess mode, System.String[] searchPaths) [0x00071] in <3f368bacb6c34f4db5fe7e90570f303a>:0
    9.   at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, APIUpdater.Framework.Configuration.IConfigurationProvider configuration, System.String[] assemblySearchPaths, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x0002b] in <3f368bacb6c34f4db5fe7e90570f303a>:0
    10.   at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, System.String[] assemblySearchPaths, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x00001] in <3f368bacb6c34f4db5fe7e90570f303a>:0
    11.   at AssemblyUpdater.Application.Program.CheckForObsoleteAPIUsage (AssemblyUpdater.Application.CommandLineSpec config) [0x00013] in <3f368bacb6c34f4db5fe7e90570f303a>:0
    12.   at AssemblyUpdater.Application.Program.Main (System.String[] args) [0x00057] in <3f368bacb6c34f4db5fe7e90570f303a>:0
    13. UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    14. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    15. UnityEngine.Logger:Log(LogType, Object)
    16. UnityEngine.Debug:LogError(Object)
    17. UnityEditor.Scripting.APIUpdaterHelper:DoesAssemblyRequireUpgrade(String) (at C:\buildslave\unity\build\Editor\Mono\Scripting\APIUpdaterHelper.cs:125)
    Code (csharp):
    1. InvalidOperationException: Operation is not valid due to the current state of the object
    2.   at System.Linq.Enumerable.Single[CustomScriptAssembly] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0
    3.   at System.Linq.Enumerable.Single[CustomScriptAssembly] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0
    4.   at UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (EditorScriptCompilationOptions options, BuildTargetGroup platformGroup, BuildTarget platform) [0x00054] in C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\EditorCompilation.cs:632
    5.   at UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+<CompileScripts>c__AnonStorey2.<>m__0 () [0x00017] in C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\EditorCompilationInterface.cs:177
    6.   at UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[Boolean] (System.Func`1 func, Boolean returnValue) [0x00003] in C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\EditorCompilationInterface.cs:75
    7. UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    8. UnityEngine.DebugLogHandler:LogException(Exception, Object)
    9. UnityEngine.Logger:LogException(Exception, Object)
    10. UnityEngine.Debug:LogException(Exception)
    11. UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:LogException(Exception) (at C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\EditorCompilationInterface.cs:55)
    12. UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:EmitExceptionAsError(Func`1, Boolean) (at C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\EditorCompilationInterface.cs:79)
    13. UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:CompileScripts(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget) (at C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\EditorCompilationInterface.cs:177)
    The latter is known bug in Unity. But I'm not sure if these bugs are responsible for not being able to open project in new version of Unity. Version 2017.1.5 is the last one which doesn't fail on loading our old project.

    Is there any workaround for this issue of massive “The associated script can not be loaded”?
    --
    Windows 10, Android, IL2CPP, .NET 3.5
     
    Last edited: Nov 30, 2018
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    The first issue is almost definitely caused by your second issue. It doesn't always work, but try closing the project, deleting your Library and Temp folders, and reopening your project.

    If that doesn't work, try reverting your project to the 5.5 version and upgrade to 5.6 then 2017. I recommend this because your first issue, which is likely causing all of your issues, starts with a function called "APIUpdaterHelper.DoesAssemblyRequireUpgrade", which sounds like it relates to upgrading scripts to be compatible with newer versions of Unity.
     
    Qbit86 likes this.
  3. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    I've tried this so many times :( At some point I had 9 (nine) different versions of Unity on my working machine. I usually start with clean git working copy (no Library/ or Temp/) and initial import takes ~3 hours :(

    I've tried both options in API Updater dialog — run it during import or defer it for manual invoke later — no success.
     
  4. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    I had success opening the project in 2017.1, but subsequent import in 2017.2 fails the same way.
     
  5. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    That's strange...

    I have an idea, but it's a bit hacky, especially if your game is large. My idea is to basically export your unity scenes and prefabs as UnityPackages in 2017.1, then importing them in a newer version of unity. I would also recommend using a version newer than the one that hasn't been working.

    If you still can't get it working, do you have any additional info about what scripts/DLLs are causing these errors from the API updater?
     
    Qbit86 likes this.
  6. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    It doesn't work even in 2017.1 anymore. Now it's another Unity bug:
    Code (csharp):
    1. ArgumentNullException: Argument cannot be null.
    2. Parameter name: source
    3. System.Linq.Check.SourceAndPredicate (System.Object source, System.Object predicate)
    4. System.Linq.Enumerable.Single[CustomScriptAssembly] (IEnumerable`1 source, System.Func`2 predicate)
    5. UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (EditorScriptCompilationOptions definesOptions, BuildTargetGroup platformGroup, BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:354)
    6. UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.CompileScripts (EditorScriptCompilationOptions definesOptions, BuildTargetGroup platformGroup, BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:80)
     
  7. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
  8. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Still have this issue on 2017.2.4 after updating 5.5.0→5.6.6→2017.1.5→2017.2.4
    Every script on every game object has heading “Nothing Selected” and yellow “The associated script can not be loaded. Please fix any compile errors and assign a valid script”.

    Due to some bug Unity fails to specify which exact errors don't allow to start working. No exceptions in log other than
    Code (csharp):
    1. System.InvalidOperationException: Operation is not valid due to the current state of the object.
    2. at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader) [0x0002f] in <a3989f8c34e6476eaca56644d5639ee8>:0
    3. at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x0004a] in <a3989f8c34e6476eaca56644d5639ee8>:0
    4. at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <a3989f8c34e6476eaca56644d5639ee8>:0
    5. at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable`1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <a3989f8c34e6476eaca56644d5639ee8>:0
    6. at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <a3989f8c34e6476eaca56644d5639ee8>:0
    7. at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <a3989f8c34e6476eaca56644d5639ee8>:0
    8. at AssemblyUpdater.Core.AssemblyUpdaterContext.ReadAssembly (System.String assemblyPath, APIUpdater.Framework.Log.IAPIUpdaterListener listener, System.IO.FileAccess mode, System.String[] searchPaths) [0x00071] in <64f297502b4f4fe0a1130b5c12492078>:0
    9. at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, APIUpdater.Framework.Configuration.IConfigurationProvider configuration, System.String[] assemblySearchPaths, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x0002b] in <64f297502b4f4fe0a1130b5c12492078>:0
    10. at AssemblyUpdater.Core.AssemblyUpdaterContext.From (System.String assemblyPath, System.String[] assemblySearchPaths, AssemblyUpdater.Core.UpdaterMode mode, APIUpdater.Framework.Log.IAPIUpdaterListener listener) [0x00001] in <64f297502b4f4fe0a1130b5c12492078>:0
    11. at AssemblyUpdater.Application.Program.CheckForObsoleteAPIUsage (AssemblyUpdater.Application.CommandLineSpec config) [0x00013] in <64f297502b4f4fe0a1130b5c12492078>:0
    12. at AssemblyUpdater.Application.Program.Main (System.String[] args) [0x00057] in <64f297502b4f4fe0a1130b5c12492078>:0
    13. UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    14. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    15. UnityEngine.Logger:Log(LogType, Object)
    16. UnityEngine.Debug:LogError(Object)
    17. UnityEditor.Scripting.APIUpdaterHelper:DoesAssemblyRequireUpgrade(String) (at C:\buildslave\unity\build\Editor\Mono\Scripting\APIUpdaterHelper.cs:116)
     
  9. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    It says that if you reload the project(reimport it like you did or change the scripting backend) and you have compilation errors.
     
  10. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    I keep reimporting it every day with different versions of Unity. Twice a day, to be precise, because full reimport takes 3.5 hours and my working day is 8 hours along.

    Now I'm removing plugins' dll's one by one, I got expected compilation errors “...are you missing an assembly reference?” in Visual Studio but no error messages in Unity 2017.2 except
    Code (csharp):
    1. Sequence contains no matching element
    2. UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)
    It's definitely malfunction of Unity.
     
  11. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
  12. KudoJimmy

    KudoJimmy

    Joined:
    Sep 6, 2017
    Posts:
    27
    You had a Backup of original Unity 5 project files? If so, try running the project, and make all the items in the scene a prefab. That error mostly happens with me if the folders are not correct. I mean if I imported an asset, and copy scene from its root folder to my Asset's root folder, it will say script not found error on every gameobject. So, to fix it I will copy the scene back to original folder with exact path or I will re-attach the script. If your game is big, I'd say export the project as Asset (.unitypackage) and import it on newer version.
     
  13. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    On all of them? We have more than 200 (two hundred) scenes in the project. (No, really, I've just counted and I'm surprised myself.)

    Which kind of incorrectness did you come across? Naming, path length, or smth like that?
     
  14. KudoJimmy

    KudoJimmy

    Joined:
    Sep 6, 2017
    Posts:
    27

    I mean like, I download ABC Terrain Pack. It has a Demo Scene, with some GameObjects and scripts attached to them. They are stored in Scenes folder inside ABC Terrain Main folder in Assets folder of my Project. Now, If I will move, that Demo Scene from ABC->Scenes to Assets->Scenes, and reload the scene, without re-saving it, it will give me errors next time I open it. It happened with me when I downloaded a Cartoon Village asset from forum. I moved the Scene file to my root folder, it gave error. To Fix it, I re-moved the file to its original folder and it stopped giving me error.

    Now, to your problem, before making all prefabs, as I mentioned above, try exporting whole project in Unity 5 to a .unitypackage file. Then under Unity 2017, create a new blank object and import the whole .unitypackage file. Re-import if necessary by Right Clicking in Project view tab.
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I might suggest try starting with a new project, and attach ONE of the problem scripts to an object. It may provide more clues.
     
  16. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    But which one is the problem? We have ~4000 of them, if I remember correctly...
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Just pick one that is generating an error, like the first one in your screenshot, likely UIRoot.cs.
     
  18. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    It doesn't show any errors in separate project on these scripts: https://prnt.sc/lsyrv4
    uiroot-ok.png
     
  19. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    I've tried to create new project for repro (2017.2.4f1 on Windows) as you suggested: https://mega.nz/#!gpQTlaKa!PMlKHibSAzR7-i3al27PjBccQUo9-NE9v4hBSQdce-8
    It contains only ONE trivial script, and bunch of third-party assemblies. This only script is still Nothing Selected with yellow warning.

    But it is Unity who is responsible for providing clues. I mean: there is Console docking window, we can filter out Errors in it. If assets have some issues and Console doesn't help diagnosing them, then it's clearly bug in Unity, isn't it?

    nothing-selected-repro.png
     
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Qbit86 Not sure what you are referring to, I don't have access to your computer system to obtain clues (additional information). By clues, I mean, sufficient instructions so that we can reproduce. And you last screenshot is NOT a new project, it has MANY assets already. Just start with a brand new project, and attach a new script to an object. Does THAT work? Please don't post external links, I won't click on them for security. Your issue "may" be a bug in Unity, but more likely is a configuration issue on your system.
     
  21. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    On a fresh project with 3 assets (scene, script, AndroidManifest.xml) everything is ok. The script is:
    Code (csharp):
    1. using System;
    2. using UnityEngine;
    3.  
    4. internal sealed class Main : MonoBehaviour
    5. {
    6.     private void OnGUI()
    7.     {
    8.         GUILayout.Label(DateTime.Now.ToString("s"));
    9.     }
    10.  
    11.     private void Update()
    12.     {
    13.         if (Input.GetKeyUp(KeyCode.Escape))
    14.             Application.Quit();
    15.     }
    16. }


    That was just popular cloud storage, usually used just for security reasons. (Not in my case since I've attached decryption key to the link itself.) But ok, I will try to attach narrowed repro with forum file uploader.

    2018-12-13-NothingSelected.Unity-2017.2.zip



    Does not contradict one another. If the issue is with configuration of my system, then Unity should detect it and report, shouldn't it? And failure to do so is a bug.

    In my case it looks like there is some unclear issue with couple of third party assemblies after API Updater run (I'm attaching them in new zip). Took me like two weeks to figure this out. Could take less if Console had provided informative messages instead of internal exceptions.

    Can you imagine the world where C++ compiler doesn't output compilation errors on templated code, just dumps some ICEs, and you have to go to forum to collectively investigate your problem, and vendor says that issue is in your code, wontfix anything on compiler site?

    Anyway, thank you very much for assisting with such obscure problem, I appreciate that!
     

    Attached Files: