private static void Load(OnlineMaps api) { if (!Exists()) { return; } string s = EditorPrefs.GetString(prefsKey); OnlineMapsXML node = OnlineMapsXML.Load(s); foreach (OnlineMapsXML el in node) { string name = el.name; if (name == "Settings") { LoadSettings(el, api); } else if (name == "Control") { LoadControl(el, api); } else if (name == "Markers") { LoadMarkers(el, api); } else if (name == "Markers3D") { LoadMarkers3D(el, api); } else if (name == "LocationService") { LoadLocationService(el, api); } } EditorPrefs.DeleteKey(prefsKey); }
// protected virtual void SavePresets() { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); int l = customPresets.Count; Debug.Log("Saving " + l + " custom presets"); if (l > 0) { bw.Write(currentVersion); bw.Write(l); for (int i = 0; i < l; i++) { Preset p = customPresets[i]; bw.Write(p.name); bw.Write(p.downsampleFactor); bw.Write(p.iterations); bw.Write(p.blurMinSpread); bw.Write(p.blurSpread); bw.Write(p.blurIntensity); } byte[] bytes = ms.ToArray(); string result = Convert.ToBase64String(bytes); EditorPrefs.SetString(editorPrefsKey, result); Debug.Log(bytes.Length); Debug.Log(result); } else if (EditorPrefs.HasKey(editorPrefsKey)) { EditorPrefs.DeleteKey(editorPrefsKey); } }
public void OnEnable() { if (afterDeserialize && EditorPrefs.HasKey(EditorName)) { var b64 = EditorPrefs.GetString(EditorName); EditorPrefs.DeleteKey(EditorName); Input = new ExtendedInput(); var sEditor = Deserializer.Deserialize <SerializableEditor>(b64); isInitialized = sEditor.IsInitialized; isInitializedGUI = sEditor.IsInitializedGUI; windowIDs = sEditor.WindowIDs; windows = sEditor.Windows; Assets.Initialize(sEditor.AssetPath); windowsGrouped.Clear(); foreach (var item in windows) { AddWindowGrouped(item); } foreach (var item in windows) { item.Editor = this; rData.AfterDeserialize.Invoke(item, null); } foreach (var item in windows) { item.SortControls(); } } afterDeserialize = false; }
static void Load() { KeyBindings.Clear(); if (!EditorPrefs.HasKey("Curvy_KeyBindings")) { Save(); } GizmoColor = String2Color(EditorPrefs.GetString("Curvy_GizmoColor", "1;0;0;1")); GizmoSelectionColor = String2Color(EditorPrefs.GetString("Curvy_GizmoSelectionColor", "1;1;1;1")); GizmoControlPointSize = EditorPrefs.GetFloat("Curvy_ControlPointSize", 0.15f); GizmoOrientationLength = EditorPrefs.GetFloat("Curvy_OrientationLength", 1); Gizmos = (CurvySplineGizmos)EditorPrefs.GetInt("Curvy_Gizmos", (int)(CurvySplineGizmos.Curve | CurvySplineGizmos.Orientation)); ToolbarLabels = (Toolbar.LabelMode)EditorPrefs.GetInt("Curvy_ToolbarLabels", (int)Toolbar.LabelMode.Icon); ToolbarOrientation = (Toolbar.Orientation)EditorPrefs.GetInt("Curvy_ToolbarOrientation", (int)Toolbar.Orientation.Top); string kbcol = EditorPrefs.GetString("Curvy_KeyBindings"); string[] binds = kbcol.Split('|'); if (binds.Length > 1) { try { for (int i = 0; i < binds.Length; i += 2) { string key = binds[i]; KeyBindings.Add(key, new EditorKeyDefinition(binds[i + 1])); } } catch { Debug.LogError("Curvy Preferences: Error loading Key Bindings! Resetting to defaults!"); EditorPrefs.DeleteKey("Curvy_KeyBindings"); } } prefsLoaded = true; SetSplineGizmoSettings(); }
/// <summary> /// Fakes a fresh start, the first time the tool is installed in the project /// </summary> //[MenuItem("Gear/Convention Checker/Fake Fresh Start")] public static void FakeFreshStart() { if (config != null) { ConfigClear(); config = null; } if (EditorPrefs.HasKey(autoRecheckKey)) { EditorPrefs.DeleteKey(autoRecheckKey); } if (EditorPrefs.HasKey(setupDoneKey)) { EditorPrefs.DeleteKey(setupDoneKey); } usingOverview = false; AssetDatabase.DeleteAsset(projectConfigFilePath); Initialize(); }
public void Initialise() { string _localNotificationJSONStr = EditorPrefs.GetString(kDidStartWithLocalNotification, string.Empty); string _remoteNotificationJSONStr = EditorPrefs.GetString(kDidStartWithRemoteNotification, string.Empty); CrossPlatformNotification _launchLocalNotification = null; CrossPlatformNotification _launchRemoteNotification = null; // Get launch local notification if (!string.IsNullOrEmpty(_localNotificationJSONStr)) { _launchLocalNotification = new CrossPlatformNotification(JSONUtility.FromJSON(_localNotificationJSONStr) as IDictionary); } else if (!string.IsNullOrEmpty(_remoteNotificationJSONStr)) { _launchRemoteNotification = new CrossPlatformNotification(JSONUtility.FromJSON(_remoteNotificationJSONStr) as IDictionary); } // Send app launch info NPBinding.NotificationService.InvokeMethod(kDidReceiveAppLaunchInfoEvent, new CrossPlatformNotification[] { _launchLocalNotification, _launchRemoteNotification }, new System.Type[] { typeof(CrossPlatformNotification), typeof(CrossPlatformNotification) }); // Remove saved values EditorPrefs.DeleteKey(kDidStartWithLocalNotification); EditorPrefs.DeleteKey(kDidStartWithRemoteNotification); }
public static void DeleteEditorPrefs() { EditorPrefs.DeleteKey(ArticyProjectFilenameKey); EditorPrefs.DeleteKey(ArticyPortraitFolderKey); EditorPrefs.DeleteKey(ArticyStageDirectionsAreSequencesKey); EditorPrefs.DeleteKey(ArticyFlowFragmentModeKey); EditorPrefs.DeleteKey(ArticyDocumentsSubmenuKey); EditorPrefs.DeleteKey(ArticyTextTableDocumentKey); EditorPrefs.DeleteKey(ArticyOutputFolderKey); EditorPrefs.DeleteKey(ArticyOverwriteKey); EditorPrefs.DeleteKey(ArticyConversionSettingsKey); EditorPrefs.DeleteKey(ArticyEncodingKey); EditorPrefs.DeleteKey(ArticyRecursionKey); EditorPrefs.DeleteKey(ArticyDropdownsKey); EditorPrefs.DeleteKey(ArticySlotsKey); EditorPrefs.DeleteKey(ArticyUseTechnicalNamesKey); EditorPrefs.DeleteKey(ArticyDirectConversationLinksToEntry1Key); EditorPrefs.DeleteKey(ArticyConvertMarkupToRichTextKey); EditorPrefs.DeleteKey(ArticySplitTextOnPipesKey); EditorPrefs.DeleteKey(ArticyFlowFragmentScriptKey); EditorPrefs.DeleteKey(ArticyVoiceOverPropertyKey); EditorPrefs.DeleteKey(ArticyLocalizationXlsKey); EditorPrefs.DeleteKey(ArticyEmVarsKey); }
private void mOneKeyBuildStep3() { string str = EditorPrefs.GetString(GetOneKeyBuildPrefKeyStep2(), string.Empty); EditorPrefs.DeleteKey(GetOneKeyBuildPrefKeyStep2()); JsonData jsonData = JsonMapper.ToObject(str); if (string.IsNullOrEmpty(str)) { return; } Debug.Log("PlayerSettingTool Begin OneKeyBuildStep3"); #if UNITY_IPHONE string target_dir = jsonData["target_dir"].GetString(); BuildIOS(target_dir, true); #endif #if UNITY_STANDALONE_WIN && !UNITY_IPHONE BuildPC(true); #endif #if UNITY_ANDROID BuildAndroid(true); #endif Debug.Log("PlayerSettingTool OneKeyBuild Finish"); }
private static void CheckUnusedState() { Utility.DebugLog("CheckUnusedState"); string key = AssetsUsageChecker.GetUniqueAssetCheckerKey(); Utility.DebugLog("Checking key: " + key + ", with result = " + EditorPrefs.HasKey(key)); if (EditorPrefs.HasKey(key)) { List <string> assets = AssetsUsageChecker.Check(); if (assets != null && assets.Count > 0) { HashSet <string> usedFiles = new HashSet <string>(); foreach (var item in assets) { usedFiles.Add(item); } APCache.UpdateUsedStatus(usedFiles); APCache.SaveToLocal(); EditorPrefs.SetString(AFTERBUILD_A_PLUS, AFTERBUILD_A_PLUS); EditorPrefs.DeleteKey(AssetsUsageChecker.GetUniqueAssetCheckerKey()); } } }
private void deletePreset( string presetName ) { string prefix = "ModelImportManager." + presetName; EditorPrefs.DeleteKey( prefix + ".GlobalScale" ); EditorPrefs.DeleteKey( prefix + ".MeshCompression" ); EditorPrefs.DeleteKey( prefix + ".OptimizeMesh" ); EditorPrefs.DeleteKey( prefix + ".AddCollider" ); EditorPrefs.DeleteKey( prefix + ".SwapUVChannels" ); EditorPrefs.DeleteKey( prefix + ".GenerateSecondaryUV" ); EditorPrefs.DeleteKey( prefix + ".NormalImportMode" ); EditorPrefs.DeleteKey( prefix + ".TangentImportMode" ); EditorPrefs.DeleteKey( prefix + ".NormalSmoothingAngle" ); EditorPrefs.DeleteKey( prefix + ".SplitTangentsAcrossSeams" ); EditorPrefs.DeleteKey( prefix + ".ImportMaterials" ); EditorPrefs.DeleteKey( prefix + ".MaterialName" ); EditorPrefs.DeleteKey( prefix + ".MaterialSearch" ); mPresetList.Remove( presetName ); savePresetList(); reset(); Debug.Log( "ModelImportManager::deletePreset, Preset '" + presetName + "' has been deleted." ); }
public static void ResetToDefaults() { if (EditorUtility.DisplayDialog("Delete ProBuilder editor preferences?", "Are you sure you want to delete these?, this action cannot be undone.", "Yes", "No")) { EditorPrefs.DeleteKey(pb_Constant.pbDefaultFaceColor); EditorPrefs.DeleteKey(pb_Constant.pbDefaultEdgeColor); EditorPrefs.DeleteKey(pb_Constant.pbDefaultOpenInDockableWindow); EditorPrefs.DeleteKey(pb_Constant.pbDefaultShortcuts); EditorPrefs.DeleteKey(pb_Constant.pbDefaultMaterial); EditorPrefs.DeleteKey(pb_Constant.pbDefaultCollider); EditorPrefs.DeleteKey(pb_Constant.pbForceConvex); EditorPrefs.DeleteKey(pb_Constant.pbShowEditorNotifications); EditorPrefs.DeleteKey(pb_Constant.pbDragCheckLimit); EditorPrefs.DeleteKey(pb_Constant.pbForceVertexPivot); EditorPrefs.DeleteKey(pb_Constant.pbForceGridPivot); EditorPrefs.DeleteKey(pb_Constant.pbManifoldEdgeExtrusion); EditorPrefs.DeleteKey(pb_Constant.pbPerimeterEdgeBridgeOnly); EditorPrefs.DeleteKey(pb_Constant.pbDefaultSelectedVertexColor); EditorPrefs.DeleteKey(pb_Constant.pbDefaultVertexColor); EditorPrefs.DeleteKey(pb_Constant.pbVertexHandleSize); EditorPrefs.DeleteKey(pb_Constant.pbPBOSelectionOnly); EditorPrefs.DeleteKey(pb_Constant.pbCloseShapeWindow); EditorPrefs.DeleteKey(pb_Constant.pbUVEditorFloating); EditorPrefs.DeleteKey(pb_Constant.pbShowSceneToolbar); EditorPrefs.DeleteKey(pb_Constant.pbUVGridSnapValue); EditorPrefs.DeleteKey(pb_Constant.pbStripProBuilderOnBuild); EditorPrefs.DeleteKey(pb_Constant.pbDisableAutoUV2Generation); EditorPrefs.DeleteKey(pb_Constant.pbShowSceneInfo); EditorPrefs.DeleteKey(pb_Constant.pbEnableBackfaceSelection); EditorPrefs.DeleteKey(pb_Constant.pbToolbarLocation); EditorPrefs.DeleteKey(pb_Constant.pbDefaultEntity); EditorPrefs.DeleteKey(pb_Constant.pbUniqueModeShortcuts); } LoadPrefs(); }
public void factoryReset() { EditorPrefs.DeleteKey("PiXYZ.Orient"); EditorPrefs.DeleteKey("PiXYZ.MapUV"); EditorPrefs.DeleteKey("PiXYZ.MapUV3dSize"); EditorPrefs.DeleteKey("PiXYZ.ScaleFactor"); EditorPrefs.DeleteKey("PiXYZ.IsRightHanded"); EditorPrefs.DeleteKey("PiXYZ.IsZUp"); EditorPrefs.DeleteKey("PiXYZ.TreeProcess"); EditorPrefs.DeleteKey("PiXYZ.LODCurrentIndex"); EditorPrefs.DeleteKey("PiXYZ.LODSettingCount"); EditorPrefs.DeleteKey("PiXYZ.UseLods"); EditorPrefs.DeleteKey("PiXYZ.LODsMode"); lodSettings = new List <PiXYZLODSettings>(); EditorPrefs.DeleteKey("PiXYZ.SplitTo16BytesIndex"); EditorPrefs.DeleteKey("PiXYZ.UseMergeFinalAssemblies"); EditorPrefs.DeleteKey("PiXYZ.ShowPopupLods"); EditorPrefs.DeleteKey("PiXYZ.AutoUpdate"); EditorPrefs.SetBool("PiXYZ.ShowPopupLods", true); EditorPrefs.SetBool("PiXYZ.AutoUpdate", true); EditorPrefs.SetBool("PiXYZ.DoNotShowAgainDocumentationPopup", false); PiXYZLoDSettingsEditor.factoryReset(); getEditorPref(); }
public static void SetObject(string prefs_key, Object obj) { if (!key_obj_list.Contains(prefs_key)) { key_obj_list.Add(prefs_key); } if (obj == null) { EditorPrefs.DeleteKey(prefs_key); } else { if (obj != null) { string path = AssetDatabase.GetAssetPath(obj); EditorPrefs.SetString(prefs_key, string.IsNullOrEmpty(path) ? obj.GetInstanceID().ToString() : path); } else { EditorPrefs.DeleteKey(prefs_key); } } }
public static void RemoveMobiledgeX() { if (EditorUtility.DisplayDialog("MobiledgeX", "Choosing Remove will delete MobiledgeX package and restart the Unity Editor", "Remove", "Cancel")) { Enhancement.SDKRemoved(getId()); if (Directory.Exists(Path.Combine("Assets", "Plugins/MobiledgeX"))) { Directory.Delete(Path.Combine("Assets", "Plugins/MobiledgeX"), true); File.Delete(Path.Combine("Assets", "Plugins/MobiledgeX") + ".meta"); } EditorPrefs.DeleteKey("mobiledgex-user"); AssetDatabase.Refresh(); RemoveRequest removeRequest = Client.Remove("com.mobiledgex.sdk"); while (removeRequest.Status != StatusCode.Success) { if (removeRequest.Status == StatusCode.Failure) { Debug.LogError("Error Removing MobiledgeX Package, Please remove the package using the package manager."); break; } } EditorApplication.OpenProject(Directory.GetCurrentDirectory()); } }
private static void SetLangModeInternal(EditorLanguage?value) { if (value == null) { EditorPrefs.DeleteKey(KEY_EDITOR_LANG); } else { switch (value) { case EditorLanguage.日本語: EditorPrefs.SetString(KEY_EDITOR_LANG, "ja"); break; case EditorLanguage.한국어: EditorPrefs.SetString(KEY_EDITOR_LANG, "ko"); break; default: EditorPrefs.SetString(KEY_EDITOR_LANG, "en"); break; } } }
/// <summary> /// Sets the layers to UI Edit Mode and 2D mode to specified scene view. /// </summary> /// <param name="state">If set to true, show only UI layer, otherwise show all layers except UI layer.</param> /// <param name="sceneView">The specific scene view.</param> public static void SetActive(bool state, SceneView sceneView) { if (state) { EditorPrefs.SetInt(k_lastLayerMaskPrefKey, Tools.visibleLayers); if (EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode3D) { sceneView.in2DMode = true; } Tools.visibleLayers = LayerMask.GetMask("UI"); } else { if (EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode3D) { sceneView.in2DMode = false; } if (EditorPrefs.HasKey(k_lastLayerMaskPrefKey)) { int mask = EditorPrefs.GetInt(k_lastLayerMaskPrefKey) & ~(1 << 5); Tools.visibleLayers = mask == 0 ? ~LayerMask.GetMask("UI") : mask; EditorPrefs.DeleteKey(k_lastLayerMaskPrefKey); } else { Tools.visibleLayers = ~LayerMask.GetMask("UI"); } } IsActive = state; }
static T FindAndEnforceSingletonScriptableObjectOfType <T>(string playerPrefsKeyOfSavedLocation) where T : ScriptableObject { string typeName = typeof(T).Name; string[] GUIDs = AssetDatabase.FindAssets("t:" + typeName); if (GUIDs.Length > 0) { string path = AssetDatabase.GUIDToAssetPath(GUIDs[0]); if (GUIDs.Length > 1) { var remainingGUID = DeleteAllButOldestScriptableObjects(GUIDs, typeName); path = AssetDatabase.GUIDToAssetPath(remainingGUID); } EditorPrefs.SetString(playerPrefsKeyOfSavedLocation, path); return(AssetDatabase.LoadAssetAtPath <T>(path)); } else { EditorPrefs.DeleteKey(playerPrefsKeyOfSavedLocation); } return(null); }
public void OnPreprocessBuild(BuildReport report) { if (EditorPrefs.GetBool("Never ask about models check")) { return; } var result = EditorUtility.DisplayDialogComplex("Would you like to check models?", "If you don't use edge shift outline you can skip this", "Check", "Skip", "Never ask again"); switch (result) { case 0: EditorPrefs.DeleteKey("Models checked"); CheckModels(); break; case 1: return; case 2: EditorPrefs.SetBool("Never ask about models check", true); break; } }
private void ResetObject(string key) { EditorPrefs.DeleteKey(key); }
static void AddComponent2GameObject() { var generateClassName = EditorPrefs.GetString("GENERATE_CLASS_NAME"); var gameObjectName = EditorPrefs.GetString("GAME_OBJECT_NAME"); var generateNamespace = EditorPrefs.GetString("GENERATE_NAMESPACE"); if (string.IsNullOrEmpty(generateClassName)) { EditorPrefs.DeleteKey("GENERATE_CLASS_NAME"); EditorPrefs.DeleteKey("GAME_OBJECT_NAME"); } else { var assemblies = AppDomain.CurrentDomain.GetAssemblies(); var defaultAssembly = assemblies.First(assembly => assembly.GetName().Name == "Assembly-CSharp"); var typeName = generateNamespace + "." + generateClassName; var type = defaultAssembly.GetType(typeName); if (type == null) { Log.I("编译失败"); return; } Log.I(type); var gameObject = GameObject.Find(gameObjectName); if (!gameObject) { Log.I("上次的 View Controller 生成失败,找不到 GameObject:{0}".FillFormat(gameObjectName)); Clear(); return; } var scriptComponent = gameObject.GetComponent(type); if (!scriptComponent) { scriptComponent = gameObject.AddComponent(type); } var serialiedScript = new SerializedObject(scriptComponent); var panelCodeInfo = new PanelCodeInfo(); panelCodeInfo.GameObjectName = gameObjectName; // 搜索所有绑定 BindCollector.SearchBinds(gameObject.transform, "", panelCodeInfo); foreach (var bindInfo in panelCodeInfo.BindInfos) { var name = bindInfo.Name; var componentName = bindInfo.BindScript.ComponentName.Split('.').Last(); serialiedScript.FindProperty(name).objectReferenceValue = gameObject.transform.Find(bindInfo.PathToElement) .GetComponent(componentName); } var codeGenerateInfo = gameObject.GetComponent <ViewController>(); if (codeGenerateInfo) { serialiedScript.FindProperty("ScriptsFolder").stringValue = codeGenerateInfo.ScriptsFolder; serialiedScript.FindProperty("PrefabFolder").stringValue = codeGenerateInfo.PrefabFolder; serialiedScript.FindProperty("GeneratePrefab").boolValue = codeGenerateInfo.GeneratePrefab; serialiedScript.FindProperty("ScriptName").stringValue = codeGenerateInfo.ScriptName; serialiedScript.FindProperty("Namespace").stringValue = codeGenerateInfo.Namespace; var generatePrefab = codeGenerateInfo.GeneratePrefab; var prefabFolder = codeGenerateInfo.PrefabFolder; var fullPrefabFolder = prefabFolder.Replace("Assets", Application.dataPath); if (codeGenerateInfo.GetType() != type) { DestroyImmediate(codeGenerateInfo, false); } serialiedScript.ApplyModifiedPropertiesWithoutUndo(); if (generatePrefab) { fullPrefabFolder.CreateDirIfNotExists(); var genereateFolder = prefabFolder + "/" + gameObject.name + ".prefab"; PrefabUtils.SaveAndConnect(genereateFolder, gameObject); } } else { serialiedScript.FindProperty("ScriptsFolder").stringValue = "Assets/Scripts"; serialiedScript.ApplyModifiedPropertiesWithoutUndo(); } Clear(); EditorUtils.MarkCurrentSceneDirty(); } }
public void OnGUI() { var resourcePath = GetResourcePath(); var logo = AssetDatabase.LoadAssetAtPath <Texture2D>(resourcePath + "logo.png"); var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box); if (logo) { GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); } EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning); scrollPosition = GUILayout.BeginScrollView(scrollPosition); int numItems = 0; if (!EditorPrefs.HasKey(ignore + buildTarget) && EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) { ++numItems; GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget))) { #if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget); #else EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget); #endif } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + buildTarget, true); } GUILayout.EndHorizontal(); } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) { ++numItems; GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen))) { PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); } GUILayout.EndHorizontal(); } #else if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) { ++numItems; GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen))) { PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); } GUILayout.EndHorizontal(); } #endif #if UNITY_2018_1_OR_NEWER #else if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) { ++numItems; GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen))) { PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); } GUILayout.EndHorizontal(); } #endif if (!EditorPrefs.HasKey(ignore + defaultScreenSize) && (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) { ++numItems; GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight))) { PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth; PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + defaultScreenSize, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + runInBackground) && PlayerSettings.runInBackground != recommended_RunInBackground) { ++numItems; GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground))) { PlayerSettings.runInBackground = recommended_RunInBackground; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + runInBackground, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) && PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) { ++numItems; GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog))) { PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + displayResolutionDialog, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + resizableWindow) && PlayerSettings.resizableWindow != recommended_ResizableWindow) { ++numItems; GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow))) { PlayerSettings.resizableWindow = recommended_ResizableWindow; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + resizableWindow, true); } GUILayout.EndHorizontal(); } #if UNITY_2018_1_OR_NEWER if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && PlayerSettings.fullScreenMode != recommended_FullScreenMode) #else if (!EditorPrefs.HasKey(ignore + fullscreenMode) && PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) #endif { ++numItems; #if UNITY_2018_1_OR_NEWER GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.fullScreenMode)); #else GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode)); #endif GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode))) { #if UNITY_2018_1_OR_NEWER PlayerSettings.fullScreenMode = recommended_FullScreenMode; #else PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; #endif } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + fullscreenMode, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + visibleInBackground) && PlayerSettings.visibleInBackground != recommended_VisibleInBackground) { ++numItems; GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground))) { PlayerSettings.visibleInBackground = recommended_VisibleInBackground; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + visibleInBackground, true); } GUILayout.EndHorizontal(); } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + renderingPath) && PlayerSettings.renderingPath != recommended_RenderPath) { ++numItems; GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA")) { PlayerSettings.renderingPath = recommended_RenderPath; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + renderingPath, true); } GUILayout.EndHorizontal(); } #endif if (!EditorPrefs.HasKey(ignore + colorSpace) && PlayerSettings.colorSpace != recommended_ColorSpace) { ++numItems; GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene")) { PlayerSettings.colorSpace = recommended_ColorSpace; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + colorSpace, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + gpuSkinning) && PlayerSettings.gpuSkinning != recommended_GpuSkinning) { ++numItems; GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning))) { PlayerSettings.gpuSkinning = recommended_GpuSkinning; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + gpuSkinning, true); } GUILayout.EndHorizontal(); } #if false if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) { ++numItems; GUILayout.Label(singlePassStereoRendering + string.Format(currentValue, PlayerSettings.singlePassStereoRendering)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePassStereoRendering))) { PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + singlePassStereoRendering, true); } GUILayout.EndHorizontal(); } #endif GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear All Ignores")) { EditorPrefs.DeleteKey(ignore + buildTarget); EditorPrefs.DeleteKey(ignore + showUnitySplashScreen); EditorPrefs.DeleteKey(ignore + defaultIsFullScreen); EditorPrefs.DeleteKey(ignore + defaultScreenSize); EditorPrefs.DeleteKey(ignore + runInBackground); EditorPrefs.DeleteKey(ignore + displayResolutionDialog); EditorPrefs.DeleteKey(ignore + resizableWindow); EditorPrefs.DeleteKey(ignore + fullscreenMode); EditorPrefs.DeleteKey(ignore + visibleInBackground); #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) EditorPrefs.DeleteKey(ignore + renderingPath); #endif EditorPrefs.DeleteKey(ignore + colorSpace); EditorPrefs.DeleteKey(ignore + gpuSkinning); #if false EditorPrefs.DeleteKey(ignore + singlePassStereoRendering); #endif } GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (numItems > 0) { if (GUILayout.Button("Accept All")) { // Only set those that have not been explicitly ignored. if (!EditorPrefs.HasKey(ignore + buildTarget)) #if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) { EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget); } #else { EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget); } #endif if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen)) #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) { PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen; } #else { PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen; } #endif #if UNITY_2018_1_OR_NEWER if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen)) { PlayerSettings.fullScreenMode = recommended_FullScreenMode; } #else if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen)) { PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; } if (!EditorPrefs.HasKey(ignore + fullscreenMode)) { PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; } #endif if (!EditorPrefs.HasKey(ignore + defaultScreenSize)) { PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth; PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight; } if (!EditorPrefs.HasKey(ignore + runInBackground)) { PlayerSettings.runInBackground = recommended_RunInBackground; } if (!EditorPrefs.HasKey(ignore + displayResolutionDialog)) { PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog; } if (!EditorPrefs.HasKey(ignore + resizableWindow)) { PlayerSettings.resizableWindow = recommended_ResizableWindow; } if (!EditorPrefs.HasKey(ignore + visibleInBackground)) { PlayerSettings.visibleInBackground = recommended_VisibleInBackground; } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + renderingPath)) { PlayerSettings.renderingPath = recommended_RenderPath; } #endif if (!EditorPrefs.HasKey(ignore + colorSpace)) { PlayerSettings.colorSpace = recommended_ColorSpace; } if (!EditorPrefs.HasKey(ignore + gpuSkinning)) { PlayerSettings.gpuSkinning = recommended_GpuSkinning; } #if false if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering)) { PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering; } #endif EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok"); Close(); } if (GUILayout.Button("Ignore All")) { if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel")) { // Only ignore those that do not currently match our recommended settings. if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) { EditorPrefs.SetBool(ignore + buildTarget, true); } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) #else if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) #endif { EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); } #if UNITY_2018_1_OR_NEWER if (PlayerSettings.fullScreenMode != recommended_FullScreenMode) { EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); EditorPrefs.SetBool(ignore + fullscreenMode, true); } #else if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) { EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); } if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) { EditorPrefs.SetBool(ignore + fullscreenMode, true); } #endif if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight) { EditorPrefs.SetBool(ignore + defaultScreenSize, true); } if (PlayerSettings.runInBackground != recommended_RunInBackground) { EditorPrefs.SetBool(ignore + runInBackground, true); } if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) { EditorPrefs.SetBool(ignore + displayResolutionDialog, true); } if (PlayerSettings.resizableWindow != recommended_ResizableWindow) { EditorPrefs.SetBool(ignore + resizableWindow, true); } if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground) { EditorPrefs.SetBool(ignore + visibleInBackground, true); } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (PlayerSettings.renderingPath != recommended_RenderPath) { EditorPrefs.SetBool(ignore + renderingPath, true); } #endif if (PlayerSettings.colorSpace != recommended_ColorSpace) { EditorPrefs.SetBool(ignore + colorSpace, true); } if (PlayerSettings.gpuSkinning != recommended_GpuSkinning) { EditorPrefs.SetBool(ignore + gpuSkinning, true); } #if false if (PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) { EditorPrefs.SetBool(ignore + singlePassStereoRendering, true); } #endif Close(); } } } else if (GUILayout.Button("Close")) { Close(); } GUILayout.EndHorizontal(); }
public static void Reset() { EditorPrefs.DeleteKey(EDITOR_PREFS_DISCORD_USERNAME + Application.productName); EditorPrefs.DeleteKey(EDITOR_PREFS_DISCORD_WEBHOOK_URL + Application.productName); EditorPrefs.DeleteKey(EDITOR_PREFS_DISCORD_IS_CONFIGURED + Application.productName); }
static void Clear() { EditorPrefs.DeleteKey("GENERATE_CLASS_NAME"); EditorPrefs.DeleteKey("GAME_OBJECT_NAME"); }
public static bool HeaderButton(string buttonName, Action OnPlusBtnClick = null, Action OnMinusBtnClick = null) { GUI.color = Color.cyan; HeaderList.Add(buttonName); bool foldOut = EditorPrefs.GetBool(buttonName, false); Rect rect = GUILayoutUtility.GetRect(GUIContent.none, Header_LeftStyle, GUILayout.ExpandWidth(true)); Rect plusBtnRect = new Rect(rect.width - 35, rect.y + 2, 25, 25); Rect minusBtnRect = new Rect(rect.width - 10, rect.y + 2, 25, 25); if (foldOut && OnPlusBtnClick != null) { // Plus Button Down if (GUI.Button(plusBtnRect, "", "label")) { OnPlusBtnClick(); } } if (foldOut && OnMinusBtnClick != null) { // Minus Button Down if (GUI.Button(minusBtnRect, "", "label")) { OnMinusBtnClick(); EditorPrefs.DeleteKey(buttonName); foldOut = false; } } // Header Button Down if (GUI.Button(rect, buttonName, Header_LeftStyle)) { // Button Up if (Event.current.button == 0) { EditorPrefs.SetBool(buttonName, !foldOut); } if (!foldOut) { foreach (var header in HeaderList) { if (header != buttonName) { EditorPrefs.SetBool(header, false); } } } } if (foldOut) { if (OnPlusBtnClick != null) { GUI.Label(plusBtnRect, iconToolbarPlus); } if (OnMinusBtnClick != null) { GUI.Label(minusBtnRect, iconToolbarMinus); } } GUI.color = Color.white; return(foldOut); }
private static void PreferencesGUI() { if (reorderableList == null) { reorderableList = new ReorderableList(backedupFolders, typeof(string)); reorderableList.drawHeaderCallback += (rect) => EditorGUI.LabelField(rect, "Backup folder list"); reorderableList.onAddCallback += (list) => { var path = EditorUtility.OpenFolderPanel("Select folder to backup", "", ""); if (string.IsNullOrEmpty(path)) { return; } var relativePath = FileUtil.GetProjectRelativePath(path); list.list.Add(string.IsNullOrEmpty(relativePath) ? path : relativePath); backedupFolders = list.list as List <string>; }; reorderableList.onRemoveCallback += (ReorderableList list) => { list.list.RemoveAt(list.index); backedupFolders = list.list as List <string>; }; } EditorGUILayout.Space(); if (!SevenZip.isSupported && !FastZip.isSupported) { EditorGUILayout.HelpBox("7Zip and FastZip aren't supported, Zip Backup won't work", MessageType.Error); return; } else if (!FastZip.isSupported) { EditorGUILayout.HelpBox("FastZip isn't supported, either Fastzip.exe was not found or Unity is not running on Windows 64bit", MessageType.Warning); } else if (!SevenZip.isSupported) { EditorGUILayout.HelpBox("7z.exe was not found, 7Zip won't work", MessageType.Warning); } scroll = EditorGUILayout.BeginScrollView(scroll, false, false); GUI.enabled = FastZip.isSupported && SevenZip.isSupported; mode = (ZipModes)EditorGUILayout.EnumPopup(zipModeContent, mode); if (!FastZip.isSupported) { mode = ZipModes._7Zip; } else if (!SevenZip.isSupported) { mode = ZipModes.FastZip; } GUI.enabled = true; EditorGUILayout.Space(); if (mode == ZipModes.FastZip) { packLevel = EditorGUILayout.IntSlider(packLevelContent, packLevel, 0, 9); GUI.enabled = packLevel > 0; earlyOut = EditorGUILayout.IntSlider(earlyOutContent, earlyOut, 0, 100); GUI.enabled = true; threads = EditorGUILayout.IntSlider(threadsContent, threads, 1, 8); } EditorGUILayout.Space(); logToConsole = EditorGUILayout.Toggle(logToConsoleContent, logToConsole); EditorGUILayout.Space(); reorderableList.DoLayoutList(); EditorGUILayout.Space(); if (useCustomSaveLocation = EditorGUILayout.Toggle(useCustomSaveLocationContent, useCustomSaveLocation)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(customSaveLocationContent, EditorStyles.popup); if (GUILayout.Button(string.IsNullOrEmpty(customSaveLocation) ? "Browse..." : customSaveLocation, EditorStyles.popup, GUILayout.Width(150f))) { var path = EditorUtility.OpenFolderPanel("Select backups destination", customSaveLocation, "Backups"); if (path.Length > 0) { customSaveLocation = path; } } EditorGUILayout.EndHorizontal(); } else { customSaveLocation = string.Empty; } EditorGUILayout.Space(); autoBackup = EditorGUILayout.ToggleLeft(autoBackupContent, autoBackup); GUI.enabled = autoBackup; EditorGUI.indentLevel++; var days = EditorGUILayout.IntSlider("Days", backupTimeSpan.Days, 0, 7); var hours = EditorGUILayout.IntSlider("Hours", backupTimeSpan.Hours, 0, 23); var minutes = EditorGUILayout.IntSlider("Minutes", backupTimeSpan.Minutes, 0, 59); if (days == 0 && hours == 0 && minutes < 5) { minutes = 5; } backupTimeSpan = new TimeSpan(days, hours, minutes, 0); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.Space(); if (lastBackupTime != DateTime.MinValue) { EditorGUILayout.LabelField("Last backup: " + lastBackupTime); } else { EditorGUILayout.LabelField("Last backup: Never backed up"); } if (backingup) { EditorGUILayout.LabelField("Next backup: Backing up now..."); } else if (!autoBackup) { EditorGUILayout.LabelField("Next backup: Disabled"); } else { EditorGUILayout.LabelField("Next backup: " + lastBackupTime.Add(backupTimeSpan)); } EditorGUILayout.EndScrollView(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Use Defaults", GUILayout.Width(120f))) { EditorPrefs.DeleteKey("BackupMode"); EditorPrefs.DeleteKey("BackupPackLevel"); EditorPrefs.DeleteKey("BackupEarlyOut"); EditorPrefs.DeleteKey("BackupThreads"); EditorPrefs.DeleteKey("BackupEnabled"); EditorPrefs.DeleteKey("BackupLogToConsole"); EditorPrefs.DeleteKey("BackupUseCustomSave"); EditorPrefs.DeleteKey("BackupCustomSave"); EditorPrefs.DeleteKey("BackupTimeSpan"); EditorPrefs.DeleteKey("BackupFoldersCount"); _backedupFolders = null; reorderableList.list = backedupFolders; } GUI.enabled = !backingup; if (GUILayout.Button("Backup now", GUILayout.Width(120f))) { StartBackup(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
public void Reset() { EditorPrefs.DeleteKey(m_key); }
public static void Reset() { EditorPrefs.DeleteKey(GitConstants.GIT_PATH); EditorPrefs.DeleteKey(GitConstants.REPOSITORY_PATH); }
private void DeleteEditorPrefs() { EditorPrefs.DeleteKey("AssetPath"); }
private static void OnScriptsReloaded() { EditorPrefs.DeleteKey("CTSVegetationStudioPackageManager"); }
public void ResetExportFolder() { EditorPrefs.DeleteKey(getExportFolderKey()); }