public void DrawMaterialInputs(GUIStyle toolbarstyle, bool style = true) { m_propertyOrderChanged = false; Color cachedColor = GUI.color; GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f); EditorGUILayout.BeginHorizontal(toolbarstyle); GUI.color = cachedColor; EditorGUI.BeginChangeCheck(); if (style) { ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties = GUILayoutToggle(ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties, PropertyOrderFoldoutStr, UIUtils.MenuItemToggleStyle); } else { ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties = GUILayoutToggle(ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties, PropertyOrderTemplateFoldoutStr, UIUtils.MenuItemToggleStyle); } if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("ExpandedProperties", ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties); } EditorGUILayout.EndHorizontal(); if (!ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties) { return; } cachedColor = GUI.color; GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f)); EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle); GUI.color = cachedColor; List <PropertyNode> nodes = UIUtils.PropertyNodesList(); if (nodes.Count != m_lastCount) { RefreshVisibleList(ref nodes); m_lastCount = nodes.Count; } if (m_propertyReordableList == null) { m_propertyReordableList = new ReorderableList(m_propertyNodesVisibleList, typeof(PropertyNode), true, false, false, false) { headerHeight = 0, footerHeight = 0, showDefaultBackground = false, drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var first = rect; first.width *= 0.60f; EditorGUI.LabelField(first, m_propertyNodesVisibleList[index].PropertyInspectorName); var second = rect; second.width *= 0.4f; second.x += first.width; if (GUI.Button(second, m_propertyNodesVisibleList[index].PropertyName, new GUIStyle("AssetLabel Partial"))) { UIUtils.FocusOnNode(m_propertyNodesVisibleList[index], 1, false); } }, onReorderCallback = (list) => { ReorderList(ref nodes); m_propertyOrderChanged = true; //RecursiveLog(); } }; ReorderList(ref nodes); } if (m_propertyReordableList != null) { if (m_propertyAdjustment == null) { m_propertyAdjustment = new GUIStyle(); m_propertyAdjustment.padding.left = 17; } EditorGUILayout.BeginVertical(m_propertyAdjustment); m_propertyReordableList.DoLayoutList(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); }
/// <summary> /// Draws the list layout properties. /// </summary> public void DrawListLayoutProperties() { bool newState = EditorGUILayout.Foldout(this.showListLayout, "List Layout", this.m_FoldoutStyle); if (newState != this.showListLayout) { EditorPrefs.SetBool(PREFS_KEY + "2", newState); this.showListLayout = newState; } if (this.showListLayout) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_ListBackgroundSpriteProperty, new GUIContent("Sprite")); if (this.m_ListBackgroundSpriteProperty.objectReferenceValue != null) { EditorGUILayout.PropertyField(this.m_ListBackgroundSpriteTypeProperty, new GUIContent("Sprite Type")); EditorGUILayout.PropertyField(this.m_ListBackgroundColorProperty, new GUIContent("Sprite Color")); } EditorGUILayout.PropertyField(this.m_ListMarginsProperty, new GUIContent("Margin"), true); EditorGUILayout.PropertyField(this.m_ListPaddingProperty, new GUIContent("Padding"), true); EditorGUILayout.PropertyField(this.m_ListSpacingProperty, new GUIContent("Spacing"), true); EditorGUILayout.PropertyField(this.m_ListAnimationTypeProperty, new GUIContent("Transition"), true); UISelectField.ListAnimationType animationType = (UISelectField.ListAnimationType) this.m_ListAnimationTypeProperty.enumValueIndex; if (animationType == UISelectField.ListAnimationType.Fade) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_ListAnimationDurationProperty, new GUIContent("Duration"), true); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } else if (animationType == UISelectField.ListAnimationType.Animation) { EditorGUILayout.PropertyField(this.m_ListAnimatorControllerProperty, new GUIContent("Animator Controller")); EditorGUILayout.PropertyField(this.m_ListlistAnimationOpenTriggerProperty, new GUIContent("Open Trigger")); EditorGUILayout.PropertyField(this.m_ListlistAnimationCloseTriggerProperty, new GUIContent("Close Trigger")); if (this.m_ListAnimatorControllerProperty.objectReferenceValue == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Prepare the triggers list List <string> triggers = new List <string>(); triggers.Add(!string.IsNullOrEmpty(this.m_ListlistAnimationOpenTriggerProperty.stringValue) ? this.m_ListlistAnimationOpenTriggerProperty.stringValue : "Open"); triggers.Add(!string.IsNullOrEmpty(this.m_ListlistAnimationCloseTriggerProperty.stringValue) ? this.m_ListlistAnimationCloseTriggerProperty.stringValue : "Close"); // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(triggers, target.name + " - List"); // Apply the controller to the property if (animatorController != null) { this.m_ListAnimatorControllerProperty.objectReferenceValue = animatorController; } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } }
public static void SetBenchmark() { #if UNITY_EDITOR EditorPrefs.SetBool("isBenchmark", true); #endif }
private static void SetEnabled(bool enabled) { IsEnabled = enabled; EditorPrefs.SetBool("FocusCamera_IsEnabled", IsEnabled); }
public void OnGUI() { GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); bool oldUseCustomDataPath = m_UseCustomDataPath; m_UseCustomDataPath = EditorGUILayout.Toggle(m_UseCustomDataPathContent, m_UseCustomDataPath); if (oldUseCustomDataPath != m_UseCustomDataPath) { EditorPrefs.SetBool(k_UseCustomDataPathKey, m_UseCustomDataPath); } if (GUILayout.Button("Open Folder")) { EditorUtility.RevealInFinder(m_DataPath); } GUILayout.EndHorizontal(); if (!m_UseCustomDataPath) { m_DataPath = Application.persistentDataPath; } else { string oldDataPath = m_DataPath; m_DataPath = EditorGUILayout.TextField(m_DataPathContent, m_DataPath); if (string.IsNullOrEmpty(m_DataPath)) { m_DataPath = Application.persistentDataPath; } if (oldDataPath != m_DataPath) { EditorPrefs.SetString(k_DataPathKey, m_DataPath); } } m_Aggregator.SetDataPath(m_DataPath); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(m_DatesContent, GUILayout.Width(35)); m_StartDate = EditorGUILayout.TextField(m_StartDate); EditorGUILayout.LabelField("-", GUILayout.Width(10)); m_EndDate = EditorGUILayout.TextField(m_EndDate); GUILayout.EndHorizontal(); // SMOOTHERS (SPACE, ROTATION, TIME) GUILayout.BeginVertical("box"); GUILayout.Label("Smooth/Unionize", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); // SPACE SmootherControl(ref m_SmoothSpaceToggle, ref m_Space, "Space", "Divider to smooth out x/y/z data", k_SmoothSpaceKey, k_SpaceKey, 2); // ROTATION SmootherControl(ref m_SmoothRotationToggle, ref m_Rotation, "Rotation", "Divider to smooth out angular data", k_SmoothRotationKey, k_RotationKey); // TIME SmootherControl(ref m_SmoothTimeToggle, ref m_Time, "Time", "Divider to smooth out passage of game time", k_SmoothTimeKey, k_KeyToTime); GUILayout.EndHorizontal(); GUILayout.EndVertical(); // SEPARATION GUILayout.Label("Separate", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GroupControl(ref m_SeparateUsers, "Users", "Separate each user into their own list. NOTE: Separating user IDs can be quite slow!", k_SeparateUsersKey); GroupControl(ref m_SeparateSessions, "Sessions", "Separate each session into its own list. NOTE: Separating unique sessions can be astonishly slow!", k_SeparateSessionKey); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GroupControl(ref m_SeparateDebug, "Is Debug", "Separate debug devices from non-debug devices", k_SeparateDebugKey); GroupControl(ref m_SeparatePlatform, "Platform", "Separate data based on platform", k_SeparatePlatformKey); GUILayout.EndHorizontal(); GroupControl(ref m_SeparateCustomField, "On Custom Field", "Separate based on one or more parameter fields", k_SeparateCustomKey); if (m_SeparateCustomField) { string oldArbitraryFieldsString = string.Join("|", m_ArbitraryFields.ToArray()); if (m_ArbitraryFields.Count == 0) { m_ArbitraryFields.Add("Field name"); } for (var a = 0; a < m_ArbitraryFields.Count; a++) { GUILayout.BeginHorizontal(); if (GUILayout.Button("-", GUILayout.MaxWidth(20f))) { m_ArbitraryFields.RemoveAt(a); break; } m_ArbitraryFields[a] = EditorGUILayout.TextField(m_ArbitraryFields[a]); if (a == m_ArbitraryFields.Count - 1 && GUILayout.Button(m_AddFieldContent)) { m_ArbitraryFields.Add("Field name"); } GUILayout.EndHorizontal(); } string currentArbitraryFieldsString = string.Join("|", m_ArbitraryFields.ToArray()); if (oldArbitraryFieldsString != currentArbitraryFieldsString) { EditorPrefs.SetString(k_ArbitraryFieldsKey, currentArbitraryFieldsString); } } GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); bool oldRemapColor = m_RemapColor; m_RemapColor = EditorGUILayout.Toggle(m_RemapColorContent, m_RemapColor); if (oldRemapColor != m_RemapColor) { EditorPrefs.SetBool(k_RemapColorKey, m_RemapColor); } if (m_RemapColor) { string oldRemapField = m_RemapColorField; int oldOptionIndex = m_RemapOptionIndex; m_RemapColorField = EditorGUILayout.TextField(m_RemapColorFieldContent, m_RemapColorField); m_RemapOptionIndex = EditorGUILayout.Popup(m_RemapOptionIndexContent, m_RemapOptionIndex, m_RemapOptions); if (m_RemapOptionIds[m_RemapOptionIndex] == AggregationMethod.Percentile) { m_Percentile = Mathf.Clamp(EditorGUILayout.FloatField(m_PercentileContent, m_Percentile), 0, 100f); } if (oldRemapField != m_RemapColorField) { EditorPrefs.SetString(k_RemapColorFieldKey, m_RemapColorField); } if (oldOptionIndex != m_RemapOptionIndex) { EditorPrefs.SetInt(k_RemapOptionIndexKey, m_RemapOptionIndex); } } GUILayout.EndVertical(); }
public override void OnInspectorGUI() { if (target.GetType() != typeof(MonoBehaviour) && target.GetType() != typeof(UnityEngine.Object)) { base.OnInspectorGUI(); return; } EditorPrefs.SetBool("Fix", GUILayout.Toggle(EditorPrefs.GetBool("Fix", true), "Fix broken scripts")); if (!EditorPrefs.GetBool("Fix", true)) { GUILayout.Label("*** SCRIPT MISSING ***"); return; } Initialize(); var iterator = this.serializedObject.GetIterator(); var first = true; while (iterator.NextVisible(first)) { first = false; if (iterator.name == "m_Script" && iterator.objectReferenceValue == null) { if (tryThisObject == (target as Component).gameObject) { tried = true; } var script = iterator.Copy(); var candidates = scripts.ToList(); while (iterator.NextVisible(false) && candidates.Count > 0) { candidates = candidates.Where(c => c.properties.ContainsKey(iterator.name)).ToList(); } if (candidates.Count == 1) { script.objectReferenceValue = candidates[0].script; serializedObject.ApplyModifiedProperties(); serializedObject.UpdateIfDirtyOrScript(); } else if (candidates.Count > 0) { foreach (var candidate in candidates) { if (GUILayout.Button("Use " + candidate.script.name)) { script.objectReferenceValue = candidate.script; serializedObject.ApplyModifiedProperties(); serializedObject.UpdateIfDirtyOrScript(); } } } else { GUILayout.Label("> No suitable scripts were found"); } break; } } base.OnInspectorGUI(); }
public override void OnInspectorGUI() { serializedObject.Update(); #if UNITY_5 DrawPropertiesExcluding(serializedObject, propertyToExclude); #endif UIConfig config = (UIConfig)target; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); itemsFoldout = EditorGUILayout.Foldout(itemsFoldout, "Config Items"); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("itemsFoldOut", itemsFoldout); } EditorGUILayout.EndHorizontal(); if (itemsFoldout) { Undo.RecordObject(config, "Items"); int len = config.Items.Count; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Add"); UIConfig.ConfigKey selectedKey = (UIConfig.ConfigKey)EditorGUILayout.EnumPopup((System.Enum)UIConfig.ConfigKey.PleaseSelect); if (selectedKey != UIConfig.ConfigKey.PleaseSelect) { int index = (int)selectedKey; if (index > len - 1) { for (int i = len; i < index; i++) { config.Items.Add(new UIConfig.ConfigValue()); } UIConfig.ConfigValue value = new UIConfig.ConfigValue(); value.valid = true; InitDefaultValue(selectedKey, value); config.Items.Add(value); } else { UIConfig.ConfigValue value = config.Items[index]; if (value == null) { value = new UIConfig.ConfigValue(); value.valid = true; InitDefaultValue(selectedKey, value); config.Items[index] = value; } else if (!value.valid) { value.valid = true; InitDefaultValue(selectedKey, value); } } } EditorGUILayout.EndHorizontal(); for (int i = 0; i < len; i++) { UIConfig.ConfigValue value = config.Items[i]; if (value == null || !value.valid) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(((UIConfig.ConfigKey)i).ToString()); switch ((UIConfig.ConfigKey)i) { case UIConfig.ConfigKey.ClickDragSensitivity: case UIConfig.ConfigKey.DefaultComboBoxVisibleItemCount: case UIConfig.ConfigKey.DefaultScrollSpeed: case UIConfig.ConfigKey.TouchDragSensitivity: case UIConfig.ConfigKey.TouchScrollSensitivity: value.i = EditorGUILayout.IntField(value.i); break; case UIConfig.ConfigKey.ButtonSound: case UIConfig.ConfigKey.GlobalModalWaiting: case UIConfig.ConfigKey.HorizontalScrollBar: case UIConfig.ConfigKey.LoaderErrorSign: case UIConfig.ConfigKey.PopupMenu: case UIConfig.ConfigKey.PopupMenu_seperator: case UIConfig.ConfigKey.TooltipsWin: case UIConfig.ConfigKey.VerticalScrollBar: case UIConfig.ConfigKey.WindowModalWaiting: case UIConfig.ConfigKey.DefaultFont: value.s = EditorGUILayout.TextField(value.s); break; case UIConfig.ConfigKey.DefaultScrollBounceEffect: case UIConfig.ConfigKey.DefaultScrollTouchEffect: case UIConfig.ConfigKey.RenderingTextBrighterOnDesktop: case UIConfig.ConfigKey.AllowSoftnessOnTopOrLeftSide: value.b = EditorGUILayout.Toggle(value.b); break; case UIConfig.ConfigKey.ButtonSoundVolumeScale: value.f = EditorGUILayout.Slider(value.f, 0, 1); break; case UIConfig.ConfigKey.ModalLayerColor: value.c = EditorGUILayout.ColorField(value.c); break; } if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30))) { config.Items[i].Reset(); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); packagesFoldOut = EditorGUILayout.Foldout(packagesFoldOut, "Preload Packages"); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("packagesFoldOut", packagesFoldOut); } EditorGUILayout.EndHorizontal(); if (packagesFoldOut) { Undo.RecordObject(config, "PreloadPackages"); EditorToolSet.LoadPackages(); if (EditorToolSet.packagesPopupContents != null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Add"); int selected = EditorGUILayout.Popup(EditorToolSet.packagesPopupContents.Length - 1, EditorToolSet.packagesPopupContents); EditorGUILayout.EndHorizontal(); if (selected != EditorToolSet.packagesPopupContents.Length - 1) { UIPackage pkg = UIPackage.GetPackages()[selected]; string tmp = pkg.assetPath.ToLower(); int pos = tmp.LastIndexOf("resources/"); if (pos != -1) { string packagePath = pkg.assetPath.Substring(pos + 10); if (config.PreloadPackages.IndexOf(packagePath) == -1) { config.PreloadPackages.Add(packagePath); } errorState = 0; } else { errorState = 10; } } } if (errorState > 0) { errorState--; EditorGUILayout.HelpBox("Package is not in resources folder.", MessageType.Warning); } int cnt = config.PreloadPackages.Count; int pi = 0; while (pi < cnt) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("" + pi + "."); config.PreloadPackages[pi] = EditorGUILayout.TextField(config.PreloadPackages[pi]); if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30))) { config.PreloadPackages.RemoveAt(pi); cnt--; } else { pi++; } EditorGUILayout.EndHorizontal(); } } else { errorState = 0; } if (serializedObject.ApplyModifiedProperties()) { (target as UIContentScaler).ApplyChangeDelay(); } }
public override void OnPreviewSettings() { if (s_Styles == null) { s_Styles = new Styles(); } InitPreview(); if (m_PreviewUtility == null) { if (GUILayout.Button(s_Styles.reload, s_Styles.preButton)) { m_Loaded = false; } return; } EditorGUI.BeginChangeCheck(); m_ShowReference = GUILayout.Toggle(m_ShowReference, s_Styles.pivot, s_Styles.preButton); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("AvatarpreviewShowReference", m_ShowReference); } //EditorGUI.BeginChangeCheck(); //m_LockParticleSystem = GUILayout.Toggle(m_LockParticleSystem, s_Styles.lockParticleSystem, s_Styles.preButton); //if (EditorGUI.EndChangeCheck()) //{ // SetSimulateMode(); //} bool flag = CycleButton(!m_Playing ? 0 : 1, s_Styles.play, s_Styles.preButton) != 0; if (flag != m_Playing) { if (flag) { SimulateEnable(); } else { SimulateDisable(); } } GUILayout.Box(s_Styles.speedScale, s_Styles.preLabel); EditorGUI.BeginChangeCheck(); m_PlaybackSpeed = PreviewSlider(m_PlaybackSpeed, 0.03f); if (EditorGUI.EndChangeCheck() && m_PreviewInstance) { ParticleSystem[] particleSystems = m_PreviewInstance.GetComponentsInChildren <ParticleSystem>(true); foreach (var particleSystem in particleSystems) { #if UNITY_5_5_OR_NEWER ParticleSystem.MainModule main = particleSystem.main; main.simulationSpeed = m_PlaybackSpeed; #else particleSystem.playbackSpeed = m_PlaybackSpeed; #endif } } GUILayout.Label(m_PlaybackSpeed.ToString("f2"), s_Styles.preLabel); }
private static void ToggleExportPNG() { exportPNG = !exportPNG; EditorPrefs.SetBool(exportPngString, exportPNG); }
private static void Menu() { EditorPrefs.SetBool(MENU_PATH, !EditorPrefs.GetBool(MENU_PATH, false)); }
void GenerateGUI() { if (DoxyFileExists) { //UnityEngine.Debug.Log(DoxyoutputProgress); GUILayout.Space(10); if (!DocsGenerated) { GUI.enabled = false; } if (GUILayout.Button("Browse Documentation", GUILayout.Height(40))) { Application.OpenURL("File://" + Config.DocDirectory + "/html/annotated.html"); } GUI.enabled = true; if (DoxygenOutput == null) { if (GUILayout.Button("Run Doxygen", GUILayout.Height(40))) { DocsGenerated = false; RunDoxygen(); } if (DocsGenerated && DoxygenLog != null) { if (GUILayout.Button("View Doxygen Log", EditorStyles.toolbarDropDown)) { ViewLog = !ViewLog; } if (ViewLog) { scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.ExpandHeight(true)); foreach (string logitem in DoxygenLog) { EditorGUILayout.SelectableLabel(logitem, EditorStyles.miniLabel, GUILayout.ExpandWidth(true)); } EditorGUILayout.EndScrollView(); } } } else { if (DoxygenOutput.isStarted() && !DoxygenOutput.isFinished()) { string currentline = DoxygenOutput.ReadLine(); DoxyoutputProgress = DoxyoutputProgress + 0.1f; if (DoxyoutputProgress >= 0.9f) { DoxyoutputProgress = 0.75f; } Rect r = EditorGUILayout.BeginVertical(); EditorGUI.ProgressBar(r, DoxyoutputProgress, currentline); GUILayout.Space(40); EditorGUILayout.EndVertical(); } if (DoxygenOutput.isFinished()) { if (Event.current.type == EventType.Repaint) { /* * If you look at what SetTheme is doing, I know, it seems a little scary to be * calling file moving operations from inside a an OnGUI call like this. And * maybe it would be a better choice to call SetTheme and update these other vars * from inside of the OnDoxygenFinished callback. But since the callback is static * that would require a little bit of messy singleton instance checking to make sure * the call back was calling into the right functions. I did try to do it that way * but for some reason the file operations failed every time. I'm not sure why. * This is what I was getting from the debugger: * * Error in file: C:/BuildAgent/work/842f9551727e852/Runtime/Mono/MonoManager.cpp at line 2212 * UnityEditor.FileUtil:DeleteFileOrDirectory(String) * UnityEditor.FileUtil:ReplaceFile(String, String) (at C:\BuildAgent\work\842f9557127e852\Editor\MonoGenerated\Editor\FileUtil.cs:42) * * Doing them here seems to work every time and the Repaint event check ensures that they will only be done once. */ SetTheme(SelectedTheme); DoxygenLog = DoxygenOutput.ReadFullLog(); DoxyoutputProgress = -1.0f; DoxygenOutput = null; DocsGenerated = true; EditorPrefs.SetBool(UnityProjectID + "DocsGenerated", DocsGenerated); } } } } else { GUIStyle ErrorLabel = new GUIStyle(EditorStyles.largeLabel); ErrorLabel.alignment = TextAnchor.MiddleCenter; GUILayout.Space(20); GUI.contentColor = Color.red; GUILayout.Label("You must set the path to your Doxygen install and \nbuild a new Doxyfile before you can generate documentation", ErrorLabel); } }
protected virtual void DrawParameters() { #if !WORKAROUND_TIMELINE if (s_FakeObjectCache == null) { s_FakeObjectCache = ScriptableObject.CreateInstance <FakeObject>(); s_FakeObjectSerializedCache = new SerializedObject(s_FakeObjectCache); } #endif var component = (VisualEffect)target; if (m_graph == null || m_asset != component.visualEffectAsset) { m_asset = component.visualEffectAsset; if (m_asset != null) { m_graph = m_asset.GetResource().GetOrCreateGraph(); } } GUI.enabled = true; if (m_graph != null) { if (m_graph.m_ParameterInfo == null) { m_graph.BuildParameterInfo(); } if (m_graph.m_ParameterInfo != null) { ShowHeader(Contents.headerParameters, false, false, false, false); List <int> stack = new List <int>(); int currentCount = m_graph.m_ParameterInfo.Length; if (currentCount == 0) { GUILayout.Label("No Parameter exposed in the asset"); } bool ignoreUntilNextCat = false; foreach (var param in m_graph.m_ParameterInfo) { --currentCount; var parameter = param; if (parameter.descendantCount > 0) { stack.Add(currentCount); currentCount = parameter.descendantCount; } if (currentCount == 0 && stack.Count > 0) { do { currentCount = stack.Last(); stack.RemoveAt(stack.Count - 1); }while (currentCount == 0); } if (string.IsNullOrEmpty(parameter.sheetType)) { if (!string.IsNullOrEmpty(parameter.name)) { if (string.IsNullOrEmpty(parameter.realType)) // This is a category { bool wasIgnored = ignoreUntilNextCat; ignoreUntilNextCat = false; var nameContent = GetGUIContent(parameter.name); bool prevState = EditorPrefs.GetBool("VFX-category-" + parameter.name, true); bool currentState = ShowHeader(nameContent, !wasIgnored, false, true, prevState); if (currentState != prevState) { EditorPrefs.SetBool("VFX-category-" + parameter.name, currentState); } if (!currentState) { ignoreUntilNextCat = true; } else { GUILayout.Space(Styles.headerBottomMargin); } } else if (!ignoreUntilNextCat) { EmptyLineControl(parameter.name, parameter.tooltip, stack.Count); } } } else if (!ignoreUntilNextCat) { var vfxField = m_VFXPropertySheet.FindPropertyRelative(parameter.sheetType + ".m_Array"); SerializedProperty property = null; if (vfxField != null) { for (int i = 0; i < vfxField.arraySize; ++i) { property = vfxField.GetArrayElementAtIndex(i); var nameProperty = property.FindPropertyRelative("m_Name").stringValue; if (nameProperty == parameter.path) { break; } property = null; } } if (property != null) { SerializedProperty overrideProperty = property.FindPropertyRelative("m_Overridden"); property = property.FindPropertyRelative("m_Value"); string firstpropName = property.name; Color previousColor = GUI.color; var animated = AnimationMode.IsPropertyAnimated(target, property.propertyPath); if (animated) { GUI.color = AnimationMode.animatedPropertyColor; } DisplayProperty(ref parameter, overrideProperty, property); if (animated) { GUI.color = previousColor; } } } EditorGUI.indentLevel = stack.Count; } } } GUILayout.Space(1); // Space for the line if the last category is closed. }
void FoldoutValueChange(EditEventArgs args, Event nativeEvent) { SetFoldState((bool)args.newValue); EditorPrefs.SetBool("foldout-" + title, (bool)args.newValue); }
private static void SetRunAutoStorageValidation(bool state) { EditorPrefs.SetBool(AUTO_VALIDATE_STORAGE_PREF, state); }
/// <summary> /// Toggle verbose logging of AppLovin SDK. If enabled AppLovin messages will appear in standard application log. All log messages will have "AppLovinSdk" tag. /// </summary> /// <param name="enabled"><c>true</c> if verbose logging should be enabled.</param> public static void SetVerboseLogging(bool enabled) { #if UNITY_EDITOR EditorPrefs.SetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, enabled); #endif }
private static void ToggleAtlasNormal() { createNormalMap = !createNormalMap; EditorPrefs.SetBool(atlasNormalString, createNormalMap); }
private void SetShowPrefForApp(AppConfig appConfig) { EditorPrefs.SetBool("Show" + appConfig.Name + "Welcome", showAtStartup); }
private static void ToggleOpeImageEditor() { openImage = !openImage; EditorPrefs.SetBool(openImageString, openImage); }
/// <summary> /// Save the specified boolean value in settings. /// </summary> static public void SetBool(string name, bool val) { EditorPrefs.SetBool(name, val); }
public override void OnInspectorGUI() { DrawStatistic(); string prefPrefix = "helpdb" + instance.GetInstanceID(); List <GHelpEntry> entries = instance.Entries; int startIndex = 0; if (onlyShowLastTenItems) { startIndex = Mathf.Max(0, entries.Count - 10); } for (int i = startIndex; i < entries.Count; ++i) { GHelpEntry e = entries[i]; e.Id = i + 1; string label = string.IsNullOrEmpty(e.Question) ? "[" + e.Id.ToString("000") + "]" : GEditorCommon.Ellipsis(string.Format("[{0}] {1}", e.Id.ToString("000"), e.Question), 100); bool expanded = GEditorCommon.Foldout(label, prefPrefix + i, false); if (expanded) { EditorGUI.indentLevel += 1; EditorGUILayout.LabelField("Id: " + e.Id.ToString("000")); EditorGUILayout.PrefixLabel("Category"); e.Category = (GCategory)EditorGUILayout.EnumPopup(e.Category); EditorGUILayout.PrefixLabel("Question"); e.Question = EditorGUILayout.TextField(e.Question); EditorGUILayout.PrefixLabel("Answer"); e.Answer = EditorGUILayout.TextArea(e.Answer, TextAreaStyle, GUILayout.Height(EditorGUIUtility.singleLineHeight * 5)); for (int j = 0; j < e.Links.Count; ++j) { EditorGUILayout.PrefixLabel("Link " + j + " (Text>URL)"); GHelpLink link = e.Links[j]; EditorGUILayout.BeginHorizontal(); link.DisplayText = EditorGUILayout.TextField(link.DisplayText); link.Link = EditorGUILayout.TextField(link.Link); EditorGUILayout.EndHorizontal(); e.Links[j] = link; } EditorGUI.indentLevel -= 1; EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("L+", GUILayout.Width(30))) { e.Links.Add(new GHelpLink()); } GUI.enabled = e.Links.Count > 0; if (GUILayout.Button("L-", GUILayout.Width(30))) { e.Links.RemoveAt(e.Links.Count - 1); } GUI.enabled = true; if (GUILayout.Button("Delete Entry")) { if (EditorUtility.DisplayDialog( "Confirm", "Delete this entry?", "OK", "Cancel")) { entries.RemoveAt(i); Event.current.Use(); continue; } } if (GUILayout.Button("Duplicate")) { GHelpEntry newEntry = entries[i]; newEntry.Links = new List <GHelpLink>(entries[i].Links); entries.Add(newEntry); string prefKey = GEditorCommon.GetProjectRelatedEditorPrefsKey("foldout", prefPrefix + (entries.Count - 1)); EditorPrefs.SetBool(prefKey, true); Event.current.Use(); continue; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } entries[i] = e; } if (GEditorCommon.RightAnchoredButton("Add")) { entries.Add(new GHelpEntry()); } EditorUtility.SetDirty(instance); }
public void showSettingsWindow() { if (image == null) { image = Resources.Load("Textures/logo", typeof(Texture2D)) as Texture2D; } var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box); if (image) { GUI.DrawTexture(rect, image, ScaleMode.ScaleToFit); } EditorGUILayout.HelpBox("Recommended project settings for ZED Unity Plugin", MessageType.Warning); scrollPosition = GUILayout.BeginScrollView(scrollPosition); int numItems = 0; if (!EditorPrefs.HasKey(ignore + buildTarget) && EditorUserBuildSettings.activeBuildTarget != needed_BuildTarget) { ++numItems; GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_BuildTarget))) { EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, needed_BuildTarget); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + buildTarget, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && PlayerSettings.SplashScreen.show != needed_ShowUnitySplashScreen) { ++numItems; GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_ShowUnitySplashScreen))) { PlayerSettings.SplashScreen.show = needed_ShowUnitySplashScreen; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) && PlayerSettings.displayResolutionDialog != needed_DisplayResolutionWindow) { ++numItems; GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_DisplayResolutionWindow))) { PlayerSettings.displayResolutionDialog = needed_DisplayResolutionWindow; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + displayResolutionDialog, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + resizableWindow) && PlayerSettings.resizableWindow != needed_ResizableWindow) { ++numItems; GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_ResizableWindow))) { PlayerSettings.resizableWindow = needed_ResizableWindow; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + resizableWindow, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + visibleInBackground) && PlayerSettings.visibleInBackground != needed_VisibleInBackground) { ++numItems; GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_VisibleInBackground))) { PlayerSettings.visibleInBackground = needed_VisibleInBackground; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + visibleInBackground, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + runInBackground) && PlayerSettings.runInBackground != needed_RunInBackground) { ++numItems; GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_RunInBackground))) { PlayerSettings.runInBackground = needed_RunInBackground; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + runInBackground, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + gpuSkinning) && PlayerSettings.gpuSkinning != needed_GPUSkinning) { ++numItems; GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_GPUSkinning))) { PlayerSettings.gpuSkinning = needed_GPUSkinning; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + gpuSkinning, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + colorSpace) && PlayerSettings.colorSpace != needed_ColorSpace) { ++numItems; GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_ColorSpace) + " - requires reloading scene")) { PlayerSettings.colorSpace = needed_ColorSpace; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + colorSpace, true); } GUILayout.EndHorizontal(); } if (!EditorPrefs.HasKey(ignore + MSAAValue) && QualitySettings.antiAliasing != needed_MSAAValue) { ++numItems; GUILayout.Label(MSAAValue + string.Format(currentValue, QualitySettings.antiAliasing) + "x Multi Sampling"); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, needed_MSAAValue))) { QualitySettings.antiAliasing = needed_MSAAValue; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Ignore")) { EditorPrefs.SetBool(ignore + MSAAValue, true); } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear All Ignores")) { EditorPrefs.DeleteKey(ignore + buildTarget); EditorPrefs.DeleteKey(ignore + showUnitySplashScreen); EditorPrefs.DeleteKey(ignore + displayResolutionDialog); EditorPrefs.DeleteKey(ignore + resizableWindow); EditorPrefs.DeleteKey(ignore + colorSpace); EditorPrefs.DeleteKey(ignore + gpuSkinning); EditorPrefs.DeleteKey(ignore + MSAAValue); EditorPrefs.DeleteKey(ignore + visibleInBackground); EditorPrefs.DeleteKey(ignore + runInBackground); EditorPrefs.DeleteKey(ignore + MSAAValue); } 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)) { EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, needed_BuildTarget); } if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen)) { PlayerSettings.SplashScreen.show = needed_ShowUnitySplashScreen; } if (!EditorPrefs.HasKey(ignore + displayResolutionDialog)) { PlayerSettings.displayResolutionDialog = needed_DisplayResolutionWindow; } if (!EditorPrefs.HasKey(ignore + resizableWindow)) { PlayerSettings.resizableWindow = needed_ResizableWindow; } if (!EditorPrefs.HasKey(ignore + colorSpace)) { PlayerSettings.colorSpace = needed_ColorSpace; } if (!EditorPrefs.HasKey(ignore + gpuSkinning)) { PlayerSettings.gpuSkinning = needed_GPUSkinning; } if (!EditorPrefs.HasKey(ignore + runInBackground)) { PlayerSettings.runInBackground = needed_RunInBackground; } if (!EditorPrefs.HasKey(ignore + visibleInBackground)) { PlayerSettings.visibleInBackground = needed_VisibleInBackground; } if (!EditorPrefs.HasKey(ignore + MSAAValue)) { QualitySettings.antiAliasing = needed_MSAAValue; } EditorUtility.DisplayDialog("Accept All", "Settings applied", "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 != needed_BuildTarget) { EditorPrefs.SetBool(ignore + buildTarget, true); } if (PlayerSettings.SplashScreen.show != needed_ShowUnitySplashScreen) { EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); } if (PlayerSettings.displayResolutionDialog != needed_DisplayResolutionWindow) { EditorPrefs.SetBool(ignore + displayResolutionDialog, true); } if (PlayerSettings.resizableWindow != needed_ResizableWindow) { EditorPrefs.SetBool(ignore + resizableWindow, true); } if (PlayerSettings.colorSpace != needed_ColorSpace) { EditorPrefs.SetBool(ignore + colorSpace, true); } if (PlayerSettings.gpuSkinning != needed_GPUSkinning) { EditorPrefs.SetBool(ignore + gpuSkinning, true); } if (PlayerSettings.runInBackground != needed_RunInBackground) { EditorPrefs.SetBool(ignore + runInBackground, true); } if (PlayerSettings.visibleInBackground != needed_VisibleInBackground) { EditorPrefs.SetBool(ignore + visibleInBackground, true); } if (QualitySettings.antiAliasing != needed_MSAAValue) { EditorPrefs.SetBool(ignore + MSAAValue, true); } Close(); } } } else if (GUILayout.Button("Close")) { Close(); } GUILayout.EndHorizontal(); }
private void OnGUI() { Window.DrawHeader("Settings", ""); float width = Mathf.Max(100f, Screen.width / 3f); if (GUI.Button(new Rect(Screen.width - width, 0, width, 17), "Reset", EditorStyles.toolbarButton)) { Builder.Reset(); } GUILayout.Space(20); //draw generic info Settings.File.GameName = EditorGUILayout.TextField("Game name", Settings.File.GameName); Settings.File.ExecutableName = EditorGUILayout.TextField("Executable name", Settings.File.ExecutableName); Settings.File.CurrentBuildDirectory = EditorGUILayout.TextField("Current build directory", Settings.File.CurrentBuildDirectory); Settings.File.BuildsDirectory = EditorGUILayout.TextField("Builds directory", Settings.File.BuildsDirectory); //show preview string buildFolder = Builder.GetBuildFolder(Builder.CurrentPlatform); string archivePath = Path.Combine(Path.GetFullPath(Settings.File.BuildsDirectory), Builder.CurrentPlatform); string[] lines = new string[] { "", "Game will be built as " + Settings.File.ExecutableName + ".exe", "To the \"" + buildFolder + "\" folder", "And also saved to \"" + archivePath + "\" folder as a .zip", "" }; EditorGUILayout.HelpBox(string.Join("\n", lines), MessageType.Info); EditorGUILayout.LabelField("Blacklists", EditorStyles.boldLabel); { EditorGUI.indentLevel++; DrawBlacklistedDirectories(); DrawBlacklistedFiles(); EditorGUI.indentLevel--; } EditorGUILayout.LabelField("General", EditorStyles.boldLabel); { EditorGUI.indentLevel++; Settings.File.UploadAfterBuild = EditorGUILayout.Toggle("Upload after building", Settings.File.UploadAfterBuild); Settings.File.BuildAfterGitPull = EditorGUILayout.Toggle("Build after pull", Settings.File.BuildAfterGitPull); if (Settings.File.BuildAfterGitPull) { int min = 30; int max = 60 * 10; Settings.File.GitFetchInterval = EditorGUILayout.IntSlider("Fetch interval (s)", Settings.File.GitFetchInterval, min, max); //Settings.File.GitPullMode = (PullMode)EditorGUILayout.EnumPopup("Pull mode", Settings.File.GitPullMode); if (EditorApplication.timeSinceStartup > lastGitCheck + 5) { lastGitCheck = EditorApplication.timeSinceStartup; } EditorGUILayout.HelpBox("Command line tools for git are expected to be installed.", MessageType.Info); } EditorGUI.indentLevel--; } EditorGUILayout.LabelField("Services", EditorStyles.boldLabel); { //draw services settings List <Service> services = Clone(Builder.Services); bool changed = false; EditorGUI.indentLevel++; //resize field int size = EditorGUILayout.IntField("Size", services.Count); if (size < 0) { size = 0; } if (size > 8) { size = 8; } if (size != services.Count) { int diff = Mathf.Abs(services.Count - size); if (size > services.Count) { //add more for (int i = 0; i < diff; i++) { Service service = Service.Get("Empty", "Service"); services.Add(service); } changed = true; } else { //remove extra for (int i = 0; i < diff; i++) { services.RemoveAt(services.Count - 1); } changed = true; } } //services array for (int i = 0; i < services.Count; i++) { services[i].Index = i; bool show = EditorPrefs.GetBool(PlayerSettings.productGUID + ShowKey + "." + i, false); show = EditorGUILayout.Foldout(show, services[i].Name); if (show) { EditorGUI.indentLevel++; //draw name field string name = EditorGUILayout.TextField("Name", services[i].Name); if (name != services[i].Name) { services[i].Name = name; changed = true; } //draw type field int selectedIndex = 0; var uniqueServices = Service.Services; string[] displayOptions = new string[uniqueServices.Count]; for (int s = 0; s < uniqueServices.Count; s++) { if (uniqueServices[s].typeName == services[i].Type) { selectedIndex = s; } displayOptions[s] = uniqueServices[s].typeName; } int newIndex = EditorGUILayout.Popup("Type", selectedIndex, displayOptions); if (newIndex != selectedIndex) { services[i] = Service.Get(displayOptions[newIndex], name); changed = true; } //draw service gui services[i].OnGUI(); EditorGUI.indentLevel--; } EditorPrefs.SetBool(PlayerSettings.productGUID + ShowKey + "." + i, show); } if (changed) { Builder.Services = services; Builder.GetServices(); } } EditorGUI.indentLevel--; }
public static void EnableLoader() { if (skipEditorFrames > 0) { skipEditorFrames--; return; } if (enabledLoaderKey == null) { enabledLoaderKey = string.Format(valveEnabledLoaderKeyTemplate, SteamVR_Settings.instance.editorAppKey); } if (EditorPrefs.HasKey(enabledLoaderKey) == false) { if (UnityEditor.PlayerSettings.virtualRealitySupported == true) { UnityEditor.PlayerSettings.virtualRealitySupported = false; Debug.Log("<b>[SteamVR Setup]</b> Disabled virtual reality support in Player Settings. <b>Because you're using XR Manager. Make sure OpenVR Loader is enabled in XR Manager UI.</b> (you can disable this by unchecking Assets/SteamVR/SteamVR_Settings.autoEnableVR)"); } var generalSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildTargetGroup.Standalone); if (generalSettings == null) { if (settingsWindow == null) { settingsWindow = SettingsService.OpenProjectSettings("Project/XR Plug-in Management"); settingsWindow.Repaint(); return; } if (settingsWindow == null || generalSettings == null) { Debug.LogWarning("<b>[SteamVR Setup]</b> Unable to access standalone xr settings while trying to enable OpenVR Loader. <b>You may need to manually enable OpenVR Loader in XR Plug-in Management (Project Settings).</b> (you can disable this by unchecking Assets/SteamVR/SteamVR_Settings.autoEnableVR)"); return; } } if (generalSettings.AssignedSettings == null) { var assignedSettings = ScriptableObject.CreateInstance <XRManagerSettings>() as XRManagerSettings; generalSettings.AssignedSettings = assignedSettings; EditorUtility.SetDirty(generalSettings); } bool existing = generalSettings.AssignedSettings.loaders.Any(loader => loader.name == valveOpenVRLoaderType); foreach (var loader in generalSettings.AssignedSettings.loaders) { Debug.Log("loader: " + loader.name); } if (!existing) { bool status = XRPackageMetadataStore.AssignLoader(generalSettings.AssignedSettings, valveOpenVRLoaderType, BuildTargetGroup.Standalone); if (status) { Debug.Log("<b>[SteamVR Setup]</b> Enabled OpenVR Loader in XR Management"); } else { Debug.LogError("<b>[SteamVR Setup]</b> Failed to enable enable OpenVR Loader in XR Management. You may need to manually open the XR Plug-in Management tab in project settings and check the OpenVR Loader box."); } } EditorPrefs.SetBool(enabledLoaderKey, true); } End(); }
void DrawUnityTools() { bool pre = showUnity; showUnity = EditorGUILayout.Foldout(showUnity, new GUIContent("Unity Tools", SpineEditorUtilities.Icons.unityIcon)); if (pre != showUnity) { EditorPrefs.SetBool("SkeletonDataAssetInspector_showUnity", showUnity); } if (showUnity) { EditorGUI.indentLevel++; EditorGUILayout.LabelField("SkeletonAnimator", EditorStyles.boldLabel); EditorGUI.indentLevel++; DrawMecanim(); EditorGUI.indentLevel--; GUILayout.Space(32); EditorGUILayout.LabelField("Baking", EditorStyles.boldLabel); EditorGUILayout.HelpBox("WARNING!\n\nBaking is NOT the same as SkeletonAnimator!\nDoes not support the following:\n\tFlipX or Y\n\tInheritScale\n\tColor Keys\n\tDraw Order Keys\n\tIK and Curves are sampled at 60fps and are not realtime.\n\tPlease read SkeletonBaker.cs comments for full details.\n\nThe main use of Baking is to export Spine projects to be used without the Spine Runtime (ie: for sale on the Asset Store, or background objects that are animated only with a wind noise generator)", MessageType.Warning, true); EditorGUI.indentLevel++; bakeAnimations = EditorGUILayout.Toggle("Bake Animations", bakeAnimations); EditorGUI.BeginDisabledGroup(bakeAnimations == false); { EditorGUI.indentLevel++; bakeIK = EditorGUILayout.Toggle("Bake IK", bakeIK); bakeEventOptions = (SendMessageOptions)EditorGUILayout.EnumPopup("Event Options", bakeEventOptions); EditorGUI.indentLevel--; } EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel++; GUILayout.BeginHorizontal(); { if (GUILayout.Button(new GUIContent("Bake All Skins", SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(150))) { SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, m_skeletonData.Skins, "", bakeAnimations, bakeIK, bakeEventOptions); } string skinName = "<No Skin>"; if (m_skeletonAnimation != null && m_skeletonAnimation.skeleton != null) { Skin bakeSkin = m_skeletonAnimation.skeleton.Skin; if (bakeSkin == null) { skinName = "Default"; bakeSkin = m_skeletonData.Skins[0]; } else { skinName = m_skeletonAnimation.skeleton.Skin.Name; } bool oops = false; try { GUILayout.BeginVertical(); if (GUILayout.Button(new GUIContent("Bake " + skinName, SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(250))) { SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, new List <Skin>(new Skin[] { bakeSkin }), "", bakeAnimations, bakeIK, bakeEventOptions); } GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Skins", SpineEditorUtilities.Icons.skinsRoot), GUILayout.Width(50)); if (GUILayout.Button(skinName, EditorStyles.popup, GUILayout.Width(196))) { SelectSkinContext(); } GUILayout.EndHorizontal(); } catch { oops = true; //GUILayout.BeginVertical(); } if (!oops) { GUILayout.EndVertical(); } } } GUILayout.EndHorizontal(); EditorGUI.indentLevel--; EditorGUI.indentLevel--; } }
/// <summary> /// Draws the select field layot properties. /// </summary> public void DrawSelectFieldLayotProperties() { bool newState = EditorGUILayout.Foldout(this.showSelectLayout, "Select Field Layout", this.m_FoldoutStyle); if (newState != this.showSelectLayout) { EditorPrefs.SetBool(PREFS_KEY + "1", newState); this.showSelectLayout = newState; } if (this.showSelectLayout) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_TransitionProperty, new GUIContent("Transition")); Graphic graphic = this.m_TargetGraphicProperty.objectReferenceValue as Graphic; Selectable.Transition transition = (Selectable.Transition) this.m_TransitionProperty.enumValueIndex; // Check if the transition requires a graphic if (transition == Selectable.Transition.ColorTint || transition == Selectable.Transition.SpriteSwap) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_TargetGraphicProperty); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } // Check if we have a transition set if (transition != Selectable.Transition.None) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); if (transition == Selectable.Transition.ColorTint) { if (graphic == null) { EditorGUILayout.HelpBox("You must have a Graphic target in order to use a color transition.", MessageType.Info); } else { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_ColorBlockProperty, true); if (EditorGUI.EndChangeCheck()) { graphic.canvasRenderer.SetColor(this.m_ColorBlockProperty.FindPropertyRelative("m_NormalColor").colorValue); } } } else if (transition == Selectable.Transition.SpriteSwap) { if (graphic as Image == null) { EditorGUILayout.HelpBox("You must have a Image target in order to use a sprite swap transition.", MessageType.Info); } else { EditorGUILayout.PropertyField(this.m_SpriteStateProperty, true); } } else if (transition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_AnimTriggerProperty, true); Animator animator = (target as UISelectField).animator; if (animator == null || animator.runtimeAnimatorController == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_AnimTriggerProperty, target.name); if (animatorController != null) { if (animator == null) { animator = (target as UISelectField).gameObject.AddComponent <Animator>(); } UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, animatorController); } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } }
public static void SetBool(string key, bool value) { EditorPrefs.SetBool(ProjectIdentifier + key, value); }
/// <summary> /// Draws the option background layout properties. /// </summary> public void DrawOptionBackgroundLayoutProperties() { bool newState = EditorGUILayout.Foldout(this.showOptionBackgroundLayout, "Option Background Layout", this.m_FoldoutStyle); if (newState != this.showOptionBackgroundLayout) { EditorPrefs.SetBool(PREFS_KEY + "5", newState); this.showOptionBackgroundLayout = newState; } if (this.showOptionBackgroundLayout) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteProperty, new GUIContent("Sprite")); if (this.m_OptionBackgroundSpriteProperty.objectReferenceValue != null) { EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteTypeProperty, new GUIContent("Sprite Type")); EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteColorProperty, new GUIContent("Sprite Color")); EditorGUILayout.PropertyField(this.m_OptionBackgroundTransitionTypeProperty, new GUIContent("Transition")); Selectable.Transition optionBgTransition = (Selectable.Transition) this.m_OptionBackgroundTransitionTypeProperty.enumValueIndex; if (optionBgTransition != Selectable.Transition.None) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); if (optionBgTransition == Selectable.Transition.ColorTint) { EditorGUILayout.PropertyField(this.m_OptionBackgroundTransColorsProperty, true); } else if (optionBgTransition == Selectable.Transition.SpriteSwap) { EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteStatesProperty, true); } else if (optionBgTransition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_OptionBackgroundAnimatorControllerProperty, new GUIContent("Animator Controller")); EditorGUILayout.PropertyField(this.m_OptionBackgroundAnimationTriggersProperty, true); if (this.m_OptionBackgroundAnimatorControllerProperty.objectReferenceValue == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_OptionBackgroundAnimationTriggersProperty, target.name + " - Option Background"); // Apply the controller to the property if (animatorController != null) { this.m_OptionBackgroundAnimatorControllerProperty.objectReferenceValue = animatorController; } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUILayout.Separator(); bool newState2 = EditorGUILayout.Foldout(this.showOptionHover, "Option Hover Overlay", this.m_FoldoutStyle); if (newState2 != this.showOptionHover) { EditorPrefs.SetBool(PREFS_KEY + "6", newState2); this.showOptionHover = newState2; } if (this.showOptionHover) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionHoverOverlayProperty, new GUIContent("Sprite")); EditorGUILayout.PropertyField(this.m_OptionHoverOverlayColorProperty, new GUIContent("Sprite Color")); if (this.m_OptionHoverOverlayProperty.objectReferenceValue != null) { EditorGUILayout.LabelField("Transition", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionHoverOverlayColorBlockProperty, new GUIContent("Colors"), true); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUILayout.Separator(); bool newState3 = EditorGUILayout.Foldout(this.showOptionPress, "Option Press Overlay", this.m_FoldoutStyle); if (newState3 != this.showOptionPress) { EditorPrefs.SetBool(PREFS_KEY + "7", newState3); this.showOptionPress = newState3; } if (this.showOptionPress) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionPressOverlayProperty, new GUIContent("Sprite")); EditorGUILayout.PropertyField(this.m_OptionPressOverlayColorProperty, new GUIContent("Sprite Color")); if (this.m_OptionPressOverlayProperty.objectReferenceValue != null) { EditorGUILayout.LabelField("Transition", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionPressOverlayColorBlockProperty, new GUIContent("Colors"), true); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } }
/// <summary> /// Update Unity Editor Preferences static void UpdateUnityPreferences(bool enabled) { if (enabled) { // App if (EditorPrefs.GetString("kScriptsDefaultApp") != CodePath) { EditorPrefs.SetString("VSCode_PreviousApp", EditorPrefs.GetString("kScriptsDefaultApp")); } EditorPrefs.SetString("kScriptsDefaultApp", CodePath); // Arguments if (EditorPrefs.GetString("kScriptEditorArgs") != "-r -g \"$(File):$(Line)\"") { EditorPrefs.SetString("VSCode_PreviousArgs", EditorPrefs.GetString("kScriptEditorArgs")); } EditorPrefs.SetString("kScriptEditorArgs", "-r -g \"$(File):$(Line)\""); EditorPrefs.SetString("kScriptEditorArgs" + CodePath, "-r -g \"$(File):$(Line)\""); // MonoDevelop Solution if (EditorPrefs.GetBool("kMonoDevelopSolutionProperties", false)) { EditorPrefs.SetBool("VSCode_PreviousMD", true); } EditorPrefs.SetBool("kMonoDevelopSolutionProperties", false); // Support Unity Proj (JS) if (EditorPrefs.GetBool("kExternalEditorSupportsUnityProj", false)) { EditorPrefs.SetBool("VSCode_PreviousUnityProj", true); } EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", false); if (!EditorPrefs.GetBool("AllowAttachedDebuggingOfEditor", false)) { EditorPrefs.SetBool("VSCode_PreviousAttach", false); } EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", true); } else { // Restore previous app if (!string.IsNullOrEmpty(EditorPrefs.GetString("VSCode_PreviousApp"))) { EditorPrefs.SetString("kScriptsDefaultApp", EditorPrefs.GetString("VSCode_PreviousApp")); } // Restore previous args if (!string.IsNullOrEmpty(EditorPrefs.GetString("VSCode_PreviousArgs"))) { EditorPrefs.SetString("kScriptEditorArgs", EditorPrefs.GetString("VSCode_PreviousArgs")); } // Restore MD setting if (EditorPrefs.GetBool("VSCode_PreviousMD", false)) { EditorPrefs.SetBool("kMonoDevelopSolutionProperties", true); } // Restore MD setting if (EditorPrefs.GetBool("VSCode_PreviousUnityProj", false)) { EditorPrefs.SetBool("kExternalEditorSupportsUnityProj", true); } // Always leave editor attaching on, I know, it solves the problem of needing to restart for this // to actually work EditorPrefs.SetBool("AllowAttachedDebuggingOfEditor", true); } FixUnityPreferences(); }
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 (!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(); } 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 (!EditorPrefs.HasKey(ignore + fullscreenMode) && PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) { ++numItems; GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode))) { PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; } 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 (!EditorPrefs.HasKey(ignore + defaultIsFullScreen)) { PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; } 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 + fullscreenMode)) { PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; } 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 (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) { EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); } 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.d3d11FullscreenMode != recommended_FullscreenMode) { EditorPrefs.SetBool(ignore + fullscreenMode, 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(); }
void DisplayStatusBar() { GUILayout.BeginHorizontal(); if (BrowserUtility.localBranchNames != null) { int currentBranch = EditorGUILayout.Popup(BrowserUtility.localBranchIndex, BrowserUtility.localBranchNames, EditorStyles.toolbarPopup, GUILayout.Width(150)); if (currentBranch != BrowserUtility.localBranchIndex) { DisplaySwitchBranchPopup(currentBranch); } } #region status strings var sb = new System.Text.StringBuilder(); bool clean = true; if (BrowserUtility.addedFileCount > 0) { sb.Append(BrowserUtility.addedFileCount).Append(" added"); clean = false; } if (BrowserUtility.copiedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.copiedFileCount).Append(" copied"); clean = false; } if (BrowserUtility.deletedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.deletedFileCount).Append(" deleted"); clean = false; } if (BrowserUtility.modifiedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.modifiedFileCount).Append(" modified"); clean = false; } if (BrowserUtility.renamedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.renamedFileCount).Append(" renamed"); clean = false; } if (BrowserUtility.unmergedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.unmergedFileCount).Append(" unmerged"); clean = false; } if (BrowserUtility.untrackedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.untrackedFileCount).Append(" untracked"); clean = false; } if (clean) { sb.Append("Clean"); } #endregion GUILayout.Label(sb.ToString(), EditorStyles.toolbarButton, GUILayout.ExpandWidth(true)); if (viewMode != BrowserViewMode.ArtistMode) { if (VersionControl.versionControlType == VersionControlType.Git) { GUI.color = BrowserUtility.stagedFiles.Count > 0 ? Color.red : Color.white; string stagedString = BrowserUtility.stagedFiles.Count > 0 ? "S (" + BrowserUtility.stagedFiles.Count + ")" : "S"; bool showStagedFilesTemp = GUILayout.Toggle(showStagedFiles, stagedString, EditorStyles.toolbarButton, GUILayout.Width(40)); GUI.color = Color.white; if (showStagedFilesTemp != showStagedFiles) { showStagedFiles = showStagedFilesTemp; EditorPrefs.SetBool("UnityVersionControl.ShowStagedFiles", showStagedFiles); verticalResizeWidget1 = Mathf.Clamp(verticalResizeWidget1, 60, position.height - 180); Repaint(); } } bool showDiffTemp = GUILayout.Toggle(showDiff, "D", EditorStyles.toolbarButton, GUILayout.Width(40)); if (showDiffTemp != showDiff) { showDiff = showDiffTemp; EditorPrefs.SetBool("UnityVersionControl.ShowDiff", showDiff); horizontalResizeWidget1 = Mathf.Clamp(horizontalResizeWidget1, 80, position.width - 80); Repaint(); } } GUILayout.EndHorizontal(); }