Reputation: 459
my Unity has a weird bug. At first everything worked fine, but then I was reinstalling it everytime because I needed different versions. Now, the installer doesn't even give me an opinion to use it with Visual Studio. So I can't go to "Open C# Project" anymore. The Script-Files open with MonoDevelop, but it doesn't give me suggestions for Unity-Related stuff (like Vector3, Quaternion, etc). Furthermore, when I go to "Preferences..." the only options are the following:
In addition, my unity shows an error in every project, but I can still build my projects because the errors go away with "Clear".
ArgumentException: Illegal characters in path.
System.IO.Path.IsPathRooted (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.Path.InsecureGetFullPath (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.Path.GetFullPath (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
UnityEditor.Utils.Paths.AreEqual (System.String pathA, System.String pathB, System.Boolean ignoreCase) (at C:/buildslave/unity/build/Editor/Mono/Utils/Paths.cs:118)
UnityEditor.VisualStudioIntegration.UnityVSSupport+<IsVisualStudio>c__AnonStorey0.<>m__1 (UnityEditor.VisualStudioPath v) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/UnityVSSupport.cs:183)
System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
UnityEditor.VisualStudioIntegration.UnityVSSupport+<IsVisualStudio>c__AnonStorey0.<>m__0 (System.Collections.Generic.KeyValuePair`2[TKey,TValue] kvp) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/UnityVSSupport.cs:183)
System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToArray () (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
UnityEditor.VisualStudioIntegration.UnityVSSupport.IsVisualStudio (System.String externalEditor, UnityEditor.VisualStudioVersion& vsVersion) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/UnityVSSupport.cs:183)
UnityEditor.VisualStudioIntegration.UnityVSSupport.InitializeVisualStudio (System.String externalEditor) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/UnityVSSupport.cs:154)
UnityEditor.VisualStudioIntegration.UnityVSSupport.Initialize (System.String editorPath) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/UnityVSSupport.cs:37)
UnityEditor.VisualStudioIntegration.UnityVSSupport.InitializeUnityVSSupport () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/UnityVSSupport.cs:23)
Upvotes: 1
Views: 882
Reputation: 26
I had the same problem. My configuration for default script editor was corrupted with an invalid path, some exceptions were throwed and some editor parts did not work.
I don't know where this configuracion is stored, but can be modified with a Unity script like this:
using UnityEngine;
using UnityEditor;
public class NewBehaviourScript : MonoBehaviour
{
void Start()
{
Debug.Log ("kScriptsDefaultApp = " + EditorPrefs.GetString("kScriptsDefaultApp"));
EditorPrefs.SetString("kScriptsDefaultApp", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe");
}
}
Attach this script to some Unity object and run the project to change your default script editor. This configuration is stored by Unity.
Upvotes: 1