private static void InitializeVisualStudio(string externalEditor) { if (externalEditor.EndsWith("UnityVS.OpenFile.exe")) { externalEditor = SyncVS.FindBestVisualStudio(); if (externalEditor != null) { ScriptEditorUtility.SetExternalScriptEditor(externalEditor); } } VisualStudioVersion vsVersion; if (!IsVisualStudio(externalEditor, out vsVersion)) { return; } m_ShouldUnityVSBeActive = true; var bridgeFile = GetVstuBridgeAssembly(vsVersion); if (bridgeFile == null) { Console.WriteLine("Unable to find bridge dll in registry for Microsoft Visual Studio Tools for Unity for " + externalEditor); return; } if (!File.Exists(bridgeFile)) { Console.WriteLine("Unable to find bridge dll on disk for Microsoft Visual Studio Tools for Unity for " + bridgeFile); return; } s_UnityVSBridgeToLoad = bridgeFile; InternalEditorUtility.RegisterPrecompiledAssembly(Path.GetFileNameWithoutExtension(bridgeFile), bridgeFile); }
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); } } }
private void WritePreferences() { ScriptEditorUtility.SetExternalScriptEditor(m_ScriptEditorPath); ScriptEditorUtility.SetExternalScriptEditorArgs(m_ScriptEditorArgs); EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", m_ExternalEditorSupportsUnityProj); EditorPrefs.SetString("kImagesDefaultApp", m_ImageAppPath); EditorPrefs.SetString("kDiffsDefaultApp", m_DiffTools.Length == 0 ? "" : m_DiffTools[m_DiffToolIndex]); WriteRecentAppsList(m_ScriptApps, m_ScriptEditorPath, kRecentScriptAppsKey); WriteRecentAppsList(m_ImageApps, m_ImageAppPath, kRecentImageAppsKey); EditorPrefs.SetBool("kAutoRefresh", m_AutoRefresh); if (Unsupported.IsDeveloperMode() || UnityConnect.preferencesEnabled) { UnityConnectPrefs.StorePanelPrefs(); } EditorPrefs.SetBool("ReopenLastUsedProjectOnStartup", m_ReopenLastUsedProjectOnStartup); EditorPrefs.SetBool("UseOSColorPicker", m_UseOSColorPicker); EditorPrefs.SetBool("EnableEditorAnalytics", m_EnableEditorAnalytics); EditorPrefs.SetBool("ShowAssetStoreSearchHits", m_ShowAssetStoreSearchHits); EditorPrefs.SetBool("VerifySavingAssets", m_VerifySavingAssets); EditorPrefs.SetInt("ScriptCompilationDuringPlay", (int)m_ScriptCompilationDuringPlay); // The Preferences window always writes all preferences, we don't want this behavior since we // want the default value to just match "IsSourceBuild" until the developer has explicitly changed it. if (m_DeveloperModeDirty) { EditorPrefs.SetBool("DeveloperMode", m_DeveloperMode); // Repaint all views to show/hide debug repaint indicator InternalEditorUtility.RepaintAllViews(); } EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", m_AllowAttachedDebuggingOfEditor); EditorPrefs.SetBool("Editor.kEnableEditorLocalization", m_EnableEditorLocalization); EditorPrefs.SetString("Editor.kEditorLocale", m_SelectedLanguage); EditorPrefs.SetBool("AllowAlphaNumericHierarchy", m_AllowAlphaNumericHierarchy); EditorPrefs.SetString("GpuDeviceName", m_GpuDevice); EditorPrefs.SetBool("GICacheEnableCustomPath", m_GICacheSettings.m_EnableCustomPath); EditorPrefs.SetInt("GICacheMaximumSizeGB", m_GICacheSettings.m_MaximumSize); EditorPrefs.SetString("GICacheFolder", m_GICacheSettings.m_CachePath); EditorPrefs.SetInt("GICacheCompressionLevel", m_GICacheSettings.m_CompressionLevel); EditorPrefs.SetInt("SpritePackerCacheMaximumSizeGB", m_SpriteAtlasCacheSize); foreach (IPreferenceWindowExtension extension in prefWinExtensions) { extension.WritePreferences(); } UnityEditor.Lightmapping.UpdateCachePath(); }
public void OnGUI() { List <IDEToolLib.IDEInfo> dic = IDEToolLib.Instance.SettingInfoList; IDEToolLib.IDEInfo version = IDEToolLib.Instance.TryGetIDEInfo(IDEToolLib.VersionKey); GUILayout.Label("CfgVer: " + version.Path); _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); foreach (IDEToolLib.IDEInfo pair in dic) { if (pair.Name != IDEToolLib.VersionKey) { EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); string tempName = GUILayout.TextField(pair.Name, new GUILayoutOption[] { GUILayout.Width(150) }); string tempPath = GUILayout.TextField(pair.Path, new GUILayoutOption[] { GUILayout.Width(400) }); if (EditorGUI.EndChangeCheck()) { pair.Name = tempName; pair.Path = tempPath; } if (GUILayout.Button("SelectEXE")) { string path = EditorUtility.OpenFilePanel("ChooseExe", "", "exe"); if (!string.IsNullOrEmpty(path)) { pair.Path = path; } } EditorGUI.BeginDisabledGroup(ScriptEditorUtility.GetExternalScriptEditor() == pair.Path); if (GUILayout.Button("USE")) { ScriptEditorUtility.SetExternalScriptEditor(pair.Path); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); } } if (GUILayout.Button("Add New IDE")) { IDEToolLib.IDEInfo newInfo = new IDEToolLib.IDEInfo("NewIDE", ""); dic.Add(newInfo); } EditorGUILayout.EndScrollView(); }
private void OnScriptEditorChanged() { ScriptEditorUtility.SetExternalScriptEditor(m_ScriptEditorPath); m_ScriptEditorArgs = ScriptEditorUtility.GetExternalScriptEditorArgs(); UnityEditor.VisualStudioIntegration.UnityVSSupport.ScriptEditorChanged(m_ScriptEditorPath.str); }