Esempio n. 1
0
 public static void Initialize(string editorPath)
 {
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         string text = editorPath ?? EditorPrefs.GetString("kScriptsDefaultApp");
         if (text.EndsWith("UnityVS.OpenFile.exe"))
         {
             text = SyncVS.FindBestVisualStudio();
             if (text != null)
             {
                 EditorPrefs.SetString("kScriptsDefaultApp", text);
             }
         }
         VisualStudioVersion version;
         if (UnityVSSupport.IsVisualStudio(text, out version))
         {
             UnityVSSupport.m_ShouldUnityVSBeActive = true;
             string vstuBridgeAssembly = UnityVSSupport.GetVstuBridgeAssembly(version);
             if (vstuBridgeAssembly == null)
             {
                 Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + text);
             }
             else if (!File.Exists(vstuBridgeAssembly))
             {
                 Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + vstuBridgeAssembly);
             }
             else
             {
                 UnityVSSupport.s_UnityVSBridgeToLoad = vstuBridgeAssembly;
                 InternalEditorUtility.SetupCustomDll(Path.GetFileNameWithoutExtension(vstuBridgeAssembly), vstuBridgeAssembly);
             }
         }
     }
 }
Esempio n. 2
0
        private static void InitializeVisualStudio(string externalEditor)
        {
            if (externalEditor.EndsWith("UnityVS.OpenFile.exe"))
            {
                externalEditor = SyncVS.FindBestVisualStudio();
                if (externalEditor != null)
                {
                    ScriptEditorUtility.SetExternalScriptEditor(externalEditor);
                }
            }
            VisualStudioVersion version;

            if (UnityVSSupport.IsVisualStudio(externalEditor, out version))
            {
                UnityVSSupport.m_ShouldUnityVSBeActive = true;
                string vstuBridgeAssembly = UnityVSSupport.GetVstuBridgeAssembly(version);
                if (vstuBridgeAssembly == null)
                {
                    Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + externalEditor);
                }
                else if (!File.Exists(vstuBridgeAssembly))
                {
                    Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + vstuBridgeAssembly);
                }
                else
                {
                    UnityVSSupport.s_UnityVSBridgeToLoad = vstuBridgeAssembly;
                    InternalEditorUtility.RegisterPrecompiledAssembly(Path.GetFileNameWithoutExtension(vstuBridgeAssembly), vstuBridgeAssembly);
                }
            }
        }