Hi,
I’ve just had a series of unity disasters and I’m hoping some more seasoned Unity developers can help me out.
Yesterday, Unity crashed and appeared to corrupt my project in interesting ways that I’m now trying to unpick.
I’ve since been through a bit of a mill of trying the latest version (2019.3.0a6, was on 2019.1 I think) but I think that’s just caused more problems.
Firstly, I’m having trouble connecting to visual studio. Unity seems to be having problems building project files, spamming the following message:
ArgumentException: Value does not fall within the expected range.
SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit) (at :0)
SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits () (at :0)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder…ctor () (at :0)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase () (at :0)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject () (at :0)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles () (at :0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at <23c160f925be47d7a4fd083a3a62c920>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at <23c160f925be47d7a4fd083a3a62c920>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters) (at <23c160f925be47d7a4fd083a3a62c920>:0)
VisualStudioEditor.ProjectGeneration.OnPreGeneratingCSProjectFiles () (at Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration.cs:423)
VisualStudioEditor.ProjectGeneration.Sync () (at Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration.cs:173)
VisualStudioEditor.VSEditor.SyncAll () (at Packages/com.unity.ide.visualstudio/Editor/VSEditor.cs:160)
UnityEditor.CodeEditorProjectSync.SyncAndOpenSolution () (at C:/buildslave/unity/build/Editor/Mono/CodeEditor/CodeEditorProjectSync.cs:43)
Now, looking at that, I’m assuming that there’s something in my project that’s causing this to barf but I can’t figure out from this message what this is and, not having the source to unity, I cannot debug this. I’ve seen others with this problem in previous unity version but none of the fixes have worked for me.
I should add that this problem doesn’t seem to affect new scenes, just my existing scene. I can debug new scenes fine without this message appearing. Therefore, I expect that there’s something amiss in either my .unity file or in other unity assets.
I thought ‘a901e57d882e417bb0759af906b6d012’ looked like a GUID (as a side note, is there a way of replacing those with dot delimited DOM identifiers, such as ‘myscene.myobject::mycomponent’ or something, like you might have writing html/javascript? it’s hard to debug a GUID) but I couldn’t find any references to that in my scene.
Is there somewhere I should look in my ‘.unity’ files, some value that’s ‘out of range’ that I might place ‘back in range’. It’s not a lot to go on but perhaps somebody who is familiar with this code can throw me a bone.
Secondly, in upgrading to the latest version of unity, there seem to be some obsoleted API calls in the library I’m maintaining- nothing too onerous (GUIxxx replaced by ui.xxx, that sort of thing) but the problem is, this seems to have caused values in instances of components to fail and then lose their values. At some point, probably while tearing my hair out with other unrelated problems, the unity file has been saved and corrupted my scene (or perhaps this happened during the crash, hard to say). Is this a common problem in Unity?