public override void OnInspectorGUI() { InspectorTools.DrawSceneField("Transition Scene", ref transitionScene, ref transitionScenePath); EditorGUILayout.LabelField("Loading End Note"); loadEndNote.stringValue = EditorGUILayout.TextArea(loadEndNote.stringValue); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { EditorGUILayout.Space(); if (binding) { Bind(); } fileName.stringValue = EditorGUILayout.TextField("File Name", fileName.stringValue); autoCreateUI.boolValue = EditorGUILayout.Toggle("Auto Create UI", autoCreateUI.boolValue); binds.isExpanded = EditorGUILayout.Foldout(binds.isExpanded, "Binds"); if (binds.isExpanded) { EditorGUI.indentLevel++; binds.arraySize = EditorGUILayout.IntField("Size", binds.arraySize); binds.arraySize = InspectorTools.DrawArraySizeButtons(binds.arraySize, 1, 1); if (bindsIndex > binds.arraySize - 1) { bindsIndex = -1; } for (int x = 0; x < binds.arraySize; x++) { SerializedProperty bindsElement = binds.GetArrayElementAtIndex(x); DrawBinds(bindsElement, x); } if (bindsIndex != -1) { int index = InspectorTools.DrawArryElementModifiers(bindsIndex, binds.arraySize, 1, 1); if (index == -1) { binds.DeleteArrayElementAtIndex(bindsIndex); bindsIndex = -1; } if (index != bindsIndex) { binds.MoveArrayElement(bindsIndex, index); bindsIndex = index; } } EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); }
void OnEnable() { transitionScene = serializedObject.FindProperty("transitionScene"); transitionScenePath = serializedObject.FindProperty("transitionScenePath"); loadEndNote = serializedObject.FindProperty("loadEndNote"); if (transitionScenePath.stringValue != "") { InspectorTools.AddSceneToBuild(new EditorBuildSettingsScene(transitionScenePath.stringValue, true), -1); } }
public void DrawBind(SerializedProperty bind, int parentIndex, int currentIndex) { SerializedProperty name = bind.FindPropertyRelative("name"); string bindName = name.stringValue; if (bindName == "") { bindName = "Bind Name"; } EditorGUILayout.BeginHorizontal(); bind.isExpanded = EditorGUILayout.Foldout(bind.isExpanded, bindName); InspectorTools.Space(2); if (bindIndex.bind == currentIndex && bindIndex.binds == parentIndex) { if (GUILayout.Button("Deselect")) { bindIndex = new BindIndex(-1, -1); } } else if (GUILayout.Button("Select")) { bindIndex = new BindIndex(currentIndex, parentIndex); } EditorGUILayout.EndHorizontal(); if (bind.isExpanded) { InspectorTools.Space(); SerializedProperty primary = bind.FindPropertyRelative("primary"); SerializedProperty secondary = bind.FindPropertyRelative("secondary"); SerializedProperty extra = bind.FindPropertyRelative("extra"); name.stringValue = EditorGUILayout.TextField("Name", name.stringValue); DrawKeyCode(primary, "Primary", new BindKeyIndex(parentIndex, currentIndex, 1)); DrawKeyCode(secondary, "Secondary", new BindKeyIndex(parentIndex, currentIndex, 2)); DrawKeyCode(extra, "Extra", new BindKeyIndex(parentIndex, currentIndex, 3)); InspectorTools.Space(); } }
public override void OnInspectorGUI() { if (binding) { Bind(); } InspectorTools.Space(1); initExpanded.boolValue = EditorGUILayout.Foldout(initExpanded.boolValue, "Init"); if (initExpanded.boolValue) { EditorGUI.indentLevel++; DrawInitRegion(); //InspectorTools.Space(2); EditorGUI.indentLevel--; } uiExpanded.boolValue = EditorGUILayout.Foldout(uiExpanded.boolValue, "UI"); if (uiExpanded.boolValue) { EditorGUI.indentLevel++; DrawUIRegion(); //InspectorTools.Space(2); EditorGUI.indentLevel--; } templatesExpanded.boolValue = EditorGUILayout.Foldout(templatesExpanded.boolValue, "Templates"); if (templatesExpanded.boolValue) { EditorGUI.indentLevel++; DrawTemplatesRegion(); //InspectorTools.Space(2); EditorGUI.indentLevel--; } menuExpanded.boolValue = EditorGUILayout.Foldout(menuExpanded.boolValue, "Menu Properties"); if (menuExpanded.boolValue) { EditorGUI.indentLevel++; DrawMenuRegion(); EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); }
void Bind() { if (!binding) { return; } InspectorBindResponse response = InspectorTools.GetBind(); if (response.keyCode != KeyCode.None) { currentBind.enumValueIndex = response.KeyCodeIndex; currentBind = null; bindIndex = -1; binding = false; } }
public static void DrawSimpleResolution(SerializedProperty res, string label, uint spaceCount = 2) { res.isExpanded = EditorGUILayout.Foldout(res.isExpanded, label); if (res.isExpanded) { EditorGUI.indentLevel++; SerializedProperty width = res.FindPropertyRelative("width"); SerializedProperty height = res.FindPropertyRelative("height"); width.intValue = EditorGUILayout.IntField("Width", width.intValue); height.intValue = EditorGUILayout.IntField("Height", height.intValue); EditorGUI.indentLevel--; InspectorTools.Space(spaceCount); } }
void CheckOrAddScenes() { Menu menu = (Menu)menuType.enumValueIndex; if (menu == Menu.Main) { SerializedProperty levelsArr = levels.FindPropertyRelative("levels"); for (int i = 0; i < levelsArr.arraySize; i++) { SerializedProperty levelPath = levelsArr.GetArrayElementAtIndex(i).FindPropertyRelative("scenePath"); InspectorTools.AddSceneToBuild(new EditorBuildSettingsScene(levelPath.stringValue, true)); } } else { SerializedProperty mainMenuLevelPath = mainMenuLevel.FindPropertyRelative("scenePath"); InspectorTools.AddSceneToBuild(new EditorBuildSettingsScene(mainMenuLevelPath.stringValue, true), 0); } }
void DrawSliderSkins() { sliderSkins.isExpanded = EditorGUILayout.Foldout(sliderSkins.isExpanded, "Slider Skins"); if (sliderSkins.isExpanded) { EditorGUI.indentLevel++; sliderSkins.arraySize = EditorGUILayout.IntField("Size", sliderSkins.arraySize); sliderSkins.arraySize = InspectorTools.DrawArraySizeButtons(sliderSkins.arraySize); for (int i = 0; i < sliderSkins.arraySize; i++) { EditorGUI.indentLevel++; SerializedProperty sliderSkin = sliderSkins.GetArrayElementAtIndex(i); DrawSliderSkin(sliderSkin, "Slider Skin " + i); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
void DrawButtonSkins() { buttonSkins.isExpanded = EditorGUILayout.Foldout(buttonSkins.isExpanded, "Button Skins"); if (buttonSkins.isExpanded) { EditorGUI.indentLevel++; buttonSkins.arraySize = EditorGUILayout.IntField("Size", buttonSkins.arraySize); buttonSkins.arraySize = InspectorTools.DrawArraySizeButtons(buttonSkins.arraySize); for (int i = 0; i < buttonSkins.arraySize; i++) { EditorGUI.indentLevel++; SerializedProperty buttonSkin = buttonSkins.GetArrayElementAtIndex(i); DrawButtonSkin(buttonSkin, "Button Skin " + i); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } }
public void DrawBinds(SerializedProperty bindsElement, int currentIndex) { SerializedProperty categoryName = bindsElement.FindPropertyRelative("categoryName"); SerializedProperty bindsArray = bindsElement.FindPropertyRelative("binds"); string categoryNameLabel = categoryName.stringValue; if (categoryNameLabel == "") { categoryNameLabel = "Category " + currentIndex; } EditorGUILayout.BeginHorizontal(); bindsArray.isExpanded = EditorGUILayout.Foldout(bindsArray.isExpanded, categoryNameLabel); if (bindsIndex == currentIndex) { if (GUILayout.Button("Deselect")) { bindsIndex = -1; } } else if (GUILayout.Button("Select")) { bindsIndex = currentIndex; } EditorGUILayout.EndHorizontal(); if (bindsArray.isExpanded) { InspectorTools.Space(); categoryName.stringValue = EditorGUILayout.TextField("Name", categoryName.stringValue); bindsArray.arraySize = EditorGUILayout.IntField("Size", bindsArray.arraySize); bindsArray.arraySize = InspectorTools.DrawArraySizeButtons(bindsArray.arraySize, 1, 1); if (bindIndex.bind > bindsArray.arraySize - 1 && bindIndex.binds == currentIndex) { bindIndex = new BindIndex(-1, -1); } EditorGUI.indentLevel += 2; for (int i = 0; i < bindsArray.arraySize; i++) { SerializedProperty bind = bindsArray.GetArrayElementAtIndex(i); DrawBind(bind, currentIndex, i); if (i == bindsArray.arraySize - 1) { InspectorTools.Space(1); } } EditorGUI.indentLevel -= 2; if (bindIndex.bind != -1 && bindIndex.binds == currentIndex) { int index = InspectorTools.DrawArryElementModifiers(bindIndex.bind, bindsArray.arraySize, 1, 1); if (index == -1) { bindsArray.DeleteArrayElementAtIndex(bindIndex.binds); bindIndex = new BindIndex(-1, -1); } if (index != bindIndex.bind) { bindsArray.MoveArrayElement(bindIndex.bind, index); bindIndex.bind = index; } } } }
void DrawMenuRegion() { menuTypeE = (Menu)menuType.enumValueIndex; menuTypeE = (Menu)EditorGUILayout.EnumPopup("Menu Type", menuTypeE); menuType.enumValueIndex = (int)menuTypeE; if (menuTypeE == Menu.Main) { EditorGUILayout.PropertyField(newGameB, new GUIContent("New Game")); levels.isExpanded = EditorGUILayout.Foldout(levels.isExpanded, "Levels"); if (levels.isExpanded) { SerializedProperty levelsArray = levels.FindPropertyRelative("levels"); SerializedProperty autoCreateUI = levels.FindPropertyRelative("autoCreateUI"); autoCreateUI.boolValue = EditorGUILayout.Toggle("Auto Create UI", autoCreateUI.boolValue); levelsArray.arraySize = EditorGUILayout.IntField("Size", levelsArray.arraySize); levelsArray.arraySize = InspectorTools.DrawArraySizeButtons(levelsArray.arraySize, 1, 1); if (levelIndex > levelsArray.arraySize - 1) { levelIndex = -1; } EditorGUI.indentLevel += 2; for (int i = 0; i < levelsArray.arraySize; i++) { SerializedProperty level = levelsArray.GetArrayElementAtIndex(i); string name = level.FindPropertyRelative("name").stringValue; if (name == "") { name = "Level Name"; } DrawGameLevel(level, name, 2, true, i); } EditorGUI.indentLevel -= 2; if (levelIndex != -1) { int index = InspectorTools.DrawArryElementModifiers(levelIndex, levelsArray.arraySize, 1, 1); if (index == -1) { levelsArray.DeleteArrayElementAtIndex(levelIndex); levelIndex = -1; } if (index != levelIndex) { levelsArray.MoveArrayElement(levelIndex, index); levelIndex = index; } } } EditorGUILayout.PropertyField(levelsScroll, new GUIContent("Levels Scroll")); EditorGUILayout.PropertyField(levelPreview, new GUIContent("Level Preview")); } else { DrawGameLevel(mainMenuLevel, "Main Menu Level"); EditorGUILayout.PropertyField(resumeB, new GUIContent("Resume Button")); EditorGUILayout.PropertyField(returnToMainB, new GUIContent("Main Menu Button", "Return To Main Menu Button")); EditorGUILayout.PropertyField(pauseMenu, new GUIContent("Pause Menu", "Pause Menu UI Object")); EditorGUILayout.PropertyField(gameUI, new GUIContent("Game UI", "Game UI Holding All UI Related To Gameplay")); } }
public override void OnInspectorGUI() { EditorGUILayout.Space(); fileName.stringValue = EditorGUILayout.TextField("File Name", fileName.stringValue); autoCreateUI.boolValue = EditorGUILayout.Toggle("Auto Create UI", autoCreateUI.boolValue); audioChannels.isExpanded = EditorGUILayout.Foldout(audioChannels.isExpanded, "Audio Channels"); if (audioChannels.isExpanded) { EditorGUI.indentLevel++; audioChannels.arraySize = EditorGUILayout.IntField("Size", audioChannels.arraySize); audioChannels.arraySize = InspectorTools.DrawArraySizeButtons(audioChannels.arraySize, 1, 1); if (channelIndex > audioChannels.arraySize - 1) { channelIndex = -1; } for (int i = 0; i < audioChannels.arraySize; i++) { SerializedProperty audioChannel = audioChannels.GetArrayElementAtIndex(i); SerializedProperty name = audioChannel.FindPropertyRelative("name"); string nameLabel = name.stringValue; if (nameLabel == "") { nameLabel = "Channel Name"; } EditorGUILayout.BeginHorizontal(); audioChannel.isExpanded = EditorGUILayout.Foldout(audioChannel.isExpanded, nameLabel); if (channelIndex == i) { if (GUILayout.Button("Deselect")) { channelIndex = -1; } } else if (GUILayout.Button("Select")) { channelIndex = i; } EditorGUILayout.EndHorizontal(); if (audioChannel.isExpanded) { InspectorTools.Space(); SerializedProperty volume = audioChannel.FindPropertyRelative("volume"); name.stringValue = EditorGUILayout.TextField("Name", name.stringValue); volume.floatValue = EditorGUILayout.Slider("Volume", volume.floatValue, 0, 1); } } if (channelIndex != -1) { int index = InspectorTools.DrawArryElementModifiers(channelIndex, audioChannels.arraySize, 1, 1); if (index == -1) { audioChannels.DeleteArrayElementAtIndex(channelIndex); channelIndex = -1; } if (index != channelIndex) { audioChannels.MoveArrayElement(channelIndex, index); channelIndex = index; } } EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); }
void DrawSelectableProperties(SerializedProperty selectionProperties, string label = "Selectable Properties", bool overrideColor = false, bool overrideSprite = false) { selectionProperties.isExpanded = EditorGUILayout.Foldout(selectionProperties.isExpanded, label); if (selectionProperties.isExpanded) { EditorGUI.indentLevel++; SerializedProperty transition = selectionProperties.FindPropertyRelative("transition"); Selectable.Transition transitionE = (Selectable.Transition)transition.enumValueIndex; transitionE = (Selectable.Transition)EditorGUILayout.EnumPopup("Transition", transitionE); transition.enumValueIndex = (int)transitionE; if (transitionE == Selectable.Transition.None) { if (overrideColor) { SerializedProperty customColor = selectionProperties.FindPropertyRelative("customColor"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Custom Color"); customColor.boolValue = EditorGUILayout.Toggle(customColor.boolValue); EditorGUILayout.EndHorizontal(); if (customColor.boolValue) { EditorGUI.indentLevel++; SerializedProperty color = selectionProperties.FindPropertyRelative("color"); EditorGUILayout.PropertyField(color, new GUIContent("Color")); InspectorTools.Space(); EditorGUI.indentLevel--; } } if (overrideSprite) { SerializedProperty customSprite = selectionProperties.FindPropertyRelative("customSprite"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Custom Sprite"); customSprite.boolValue = EditorGUILayout.Toggle(customSprite.boolValue); EditorGUILayout.EndHorizontal(); if (customSprite.boolValue) { EditorGUI.indentLevel++; SerializedProperty sprite = selectionProperties.FindPropertyRelative("sprite"); EditorGUILayout.PropertyField(sprite, new GUIContent("Sprite")); EditorGUI.indentLevel--; } } } else { EditorGUIUtility.labelWidth += 50; if (transitionE == Selectable.Transition.ColorTint) { SerializedProperty colors = selectionProperties.FindPropertyRelative("colors"); EditorGUILayout.PropertyField(colors, new GUIContent("Colors")); InspectorTools.Space(); SerializedProperty customSprite = selectionProperties.FindPropertyRelative("customSprite"); customSprite.boolValue = EditorGUILayout.Toggle("Custom Sprite", customSprite.boolValue); if (customSprite.boolValue) { EditorGUI.indentLevel++; SerializedProperty sprite = selectionProperties.FindPropertyRelative("sprite"); EditorGUILayout.PropertyField(sprite, new GUIContent("Sprite")); EditorGUI.indentLevel--; } } else if (transitionE == Selectable.Transition.Animation) { SerializedProperty animations = selectionProperties.FindPropertyRelative("animations"); EditorGUILayout.PropertyField(animations, new GUIContent("Animations")); } else if (transitionE == Selectable.Transition.SpriteSwap) { SerializedProperty Sprites = selectionProperties.FindPropertyRelative("sprites"); EditorGUILayout.PropertyField(Sprites, new GUIContent("Sprites")); } EditorGUIUtility.labelWidth -= 50; } EditorGUI.indentLevel--; } }
public override void OnInspectorGUI() { InspectorTools.Space(); savedValues.isExpanded = EditorGUILayout.Foldout(savedValues.isExpanded, "Saved Values"); if (savedValues.isExpanded) { EditorGUI.indentLevel++; DrawArraySizer(savedValues); savedValues.arraySize = InspectorTools.DrawArraySizeButtons(savedValues.arraySize, 1, 1); if (savedValueIndex > savedValues.arraySize - 1) { savedValueIndex = -1; } InspectorTools.Space(); for (int i = 0; i < savedValues.arraySize; i++) { SerializedProperty savedValue = savedValues.GetArrayElementAtIndex(i); SerializedProperty name = savedValue.FindPropertyRelative("name"); string savedValueLabel = name.stringValue; if (savedValueLabel == "") { savedValueLabel = "Saved Value " + i; } EditorGUILayout.BeginHorizontal(); savedValue.isExpanded = EditorGUILayout.Foldout(savedValue.isExpanded, savedValueLabel); if (savedValueIndex == i) { if (GUILayout.Button("Deselect")) { savedValueIndex = -1; } } else if (GUILayout.Button("Select")) { savedValueIndex = i; } EditorGUILayout.EndHorizontal(); if (savedValue.isExpanded) { InspectorTools.Space(); name.stringValue = EditorGUILayout.TextField(name.stringValue); SerializedProperty uiType = savedValue.FindPropertyRelative("uiType"); uiTypeE = (SavedValue.UI)uiType.enumValueIndex; uiTypeE = (SavedValue.UI)EditorGUILayout.EnumPopup("UI", uiTypeE); uiType.enumValueIndex = (int)uiTypeE; SerializedProperty ui = null; SerializedProperty value; switch (uiTypeE) { case SavedValue.UI.InputField: //Input Field ui = savedValue.FindPropertyRelative("inf"); EditorGUILayout.PropertyField(ui, new GUIContent("InputField")); SerializedProperty infData = savedValue.FindPropertyRelative("infData"); infDataE = (SavedValue.InputFieldData)infData.enumValueIndex; infDataE = (SavedValue.InputFieldData)EditorGUILayout.EnumPopup("Data", infDataE); infData.enumValueIndex = (int)infDataE; switch (infDataE) { case SavedValue.InputFieldData.Int: //Input Field Int value = savedValue.FindPropertyRelative("iValue"); value.intValue = EditorGUILayout.IntField("Value", value.intValue); break; case SavedValue.InputFieldData.Float: //Input Field Float value = savedValue.FindPropertyRelative("fValue"); value.floatValue = EditorGUILayout.FloatField("Value", value.floatValue); break; case SavedValue.InputFieldData.String: //Input Field String value = savedValue.FindPropertyRelative("sValue"); value.stringValue = EditorGUILayout.TextField("Value", value.stringValue); break; } break; case SavedValue.UI.Slider: //Slider ui = savedValue.FindPropertyRelative("sl"); EditorGUILayout.PropertyField(ui, new GUIContent("Slider")); SerializedProperty slData = savedValue.FindPropertyRelative("slData"); slDataE = (SavedValue.SliderData)slData.enumValueIndex; slDataE = (SavedValue.SliderData)EditorGUILayout.EnumPopup("Data", slDataE); slData.enumValueIndex = (int)slDataE; switch (slDataE) { case SavedValue.SliderData.Int: //slider int value = savedValue.FindPropertyRelative("iValue"); value.intValue = EditorGUILayout.IntField("Value", value.intValue); break; case SavedValue.SliderData.Float: //slider float value = savedValue.FindPropertyRelative("fValue"); value.floatValue = EditorGUILayout.FloatField("Value", value.floatValue); break; } break; case SavedValue.UI.Toggle: ui = savedValue.FindPropertyRelative("togg"); EditorGUILayout.PropertyField(ui, new GUIContent("Toggle")); value = savedValue.FindPropertyRelative("bValue"); value.boolValue = EditorGUILayout.Toggle("Value", value.boolValue); break; case SavedValue.UI.DropDown: ui = savedValue.FindPropertyRelative("drop"); EditorGUILayout.PropertyField(ui, new GUIContent("DropDown")); value = savedValue.FindPropertyRelative("iValue"); value.intValue = EditorGUILayout.IntField("Value", value.intValue); break; } InspectorTools.Space(1); } } EditorGUI.indentLevel--; if (savedValueIndex != -1) { int index = InspectorTools.DrawArryElementModifiers(savedValueIndex, savedValues.arraySize, 1, 1); if (index == -1) { savedValues.DeleteArrayElementAtIndex(savedValueIndex); savedValueIndex = -1; } else if (index != savedValueIndex) { savedValues.MoveArrayElement(savedValueIndex, index); savedValueIndex = index; } } } if (GUILayout.Button("Delete Saved Values")) { item.DeleteAll(); } serializedObject.ApplyModifiedProperties(); }
public void DrawMenuSettings(SerializedProperty sett, string label, uint expandSpace = 0) { sett.isExpanded = EditorGUILayout.Foldout(sett.isExpanded, label); if (sett.isExpanded) { EditorGUI.indentLevel++; settingsFileName.stringValue = EditorGUILayout.TextField("File Name", settingsFileName.stringValue); SerializedProperty volume = sett.FindPropertyRelative("volume"); SerializedProperty shadows = sett.FindPropertyRelative("shadows"); SerializedProperty shadowsQuality = sett.FindPropertyRelative("shadowsQuality"); SerializedProperty antiAliasing = sett.FindPropertyRelative("antiAliasing"); SerializedProperty anisotropicFiltering = sett.FindPropertyRelative("anisotropicFiltering"); SerializedProperty realTimeReflections = sett.FindPropertyRelative("realTimeReflections"); SerializedProperty vSync = sett.FindPropertyRelative("vSync"); SerializedProperty resolution = sett.FindPropertyRelative("resolution"); SerializedProperty fullScreen = sett.FindPropertyRelative("fullScreen"); MenuSettings.Shadow shadowsE = (MenuSettings.Shadow)shadows.enumValueIndex; MenuSettings.ShadowQuality shadowsQualityE = (MenuSettings.ShadowQuality)shadowsQuality.enumValueIndex; MenuSettings.AntiAliasing antiAliasingE = (MenuSettings.AntiAliasing)antiAliasing.enumValueIndex; AnisotropicFiltering AF = (AnisotropicFiltering)anisotropicFiltering.enumValueIndex; MenuSettings.VSync vSyncE = (MenuSettings.VSync)vSync.enumValueIndex; volume.floatValue = EditorGUILayout.Slider("Volume", volume.floatValue, 0, 1); shadowsE = (MenuSettings.Shadow)EditorGUILayout.EnumPopup("Shadows", shadowsE); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Shadows Quality"); shadowsQualityE = (MenuSettings.ShadowQuality)EditorGUILayout.EnumPopup(shadowsQualityE); EditorGUILayout.EndHorizontal(); antiAliasingE = (MenuSettings.AntiAliasing)EditorGUILayout.EnumPopup("AntiAliasing", antiAliasingE); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Anisotropic Filtering"); AF = (AnisotropicFiltering)EditorGUILayout.EnumPopup(AF); EditorGUILayout.EndHorizontal(); shadows.enumValueIndex = (int)shadowsE; shadowsQuality.enumValueIndex = (int)shadowsQualityE; antiAliasing.enumValueIndex = (int)antiAliasingE; anisotropicFiltering.enumValueIndex = (int)AF; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("RealTime Reflections"); realTimeReflections.boolValue = EditorGUILayout.Toggle(realTimeReflections.boolValue); EditorGUILayout.EndHorizontal(); vSyncE = (MenuSettings.VSync)EditorGUILayout.EnumPopup("V-Sync", vSyncE); vSync.enumValueIndex = (int)vSyncE; resolution.intValue = EditorGUILayout.IntField("Resolution Index", resolution.intValue); fullScreen.boolValue = EditorGUILayout.Toggle("Full Screen", fullScreen.boolValue); EditorGUI.indentLevel--; InspectorTools.Space(expandSpace); } }
public void DrawGameLevel(SerializedProperty level, string label, uint spaceCount = 0, bool arrayMem = false, int currentIndex = 0) { EditorGUILayout.BeginHorizontal(); level.isExpanded = EditorGUILayout.Foldout(level.isExpanded, label); InspectorTools.Space(2); if (arrayMem) { if (levelIndex == currentIndex) { if (GUILayout.Button("Deselect")) { levelIndex = -1; } } else if (GUILayout.Button("Select")) { levelIndex = currentIndex; } } EditorGUILayout.EndHorizontal(); if (arrayMem) { InspectorTools.Space(); } if (level.isExpanded) { EditorGUI.indentLevel++; SerializedProperty name = level.FindPropertyRelative("name"); SerializedProperty sceneName = level.FindPropertyRelative("sceneName"); SerializedProperty scenePath = level.FindPropertyRelative("scenePath"); SerializedProperty image = level.FindPropertyRelative("image"); SerializedProperty description = level.FindPropertyRelative("description"); if (scenePath.stringValue == "" || sceneName.stringValue == "") { sceneName.stringValue = ""; scenePath.stringValue = ""; } SceneAsset scene = AssetDatabase.LoadAssetAtPath <SceneAsset>(scenePath.stringValue); EditorGUI.BeginChangeCheck(); scene = (SceneAsset)EditorGUILayout.ObjectField("Scene", scene, typeof(SceneAsset), false); if (EditorGUI.EndChangeCheck()) { if (scene) { scenePath.stringValue = AssetDatabase.GetAssetPath(scene); sceneName.stringValue = scene.name; InspectorTools.AddSceneToBuild(new EditorBuildSettingsScene(scenePath.stringValue, true), 0); } else { sceneName.stringValue = ""; scenePath.stringValue = ""; } } EditorGUILayout.PropertyField(image, new GUIContent("Preview")); name.stringValue = EditorGUILayout.TextField("Name", name.stringValue); EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField("Description"); description.stringValue = EditorGUILayout.TextArea(description.stringValue); EditorGUILayout.EndVertical(); InspectorTools.Space(spaceCount); EditorGUI.indentLevel--; } }