public static UpdateParamsOnEmitter ( |
||
serializedObject | ||
path | string | |
Résultat | void |
private void CreateEventInStudio() { string eventGuid = EditorUtils.CreateStudioEvent(eventFolder, eventName); if (!string.IsNullOrEmpty(eventGuid)) { EditorUtils.GetScriptOutput(String.Format("studio.project.lookup(\"{0}\").relationships.banks.add(studio.project.lookup(\"{1}\"));", eventGuid, banks[selectedBank].guid)); EditorUtils.GetScriptOutput("studio.project.build();"); string fullPath = "event:" + eventFolder + eventName; outputProperty.stringValue = fullPath; EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, fullPath); outputProperty.serializedObject.ApplyModifiedProperties(); } }
private void SetOutputProperty(ScriptableObject data) { if (data is EditorEventRef) { string path = (data as EditorEventRef).Path; outputProperty.stringValue = path; EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, path); } else if (data is EditorBankRef) { outputProperty.stringValue = (data as EditorBankRef).Name; } else if (data is EditorParamRef) { outputProperty.stringValue = (data as EditorParamRef).Name; } outputProperty.serializedObject.ApplyModifiedProperties(); }
void OnGUI() { if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) { // Brute force hack to stop us calling DLL functions while Unity is starting up // playing in editor mode and will cause us to leak system objects this.ShowNotification(new GUIContent("Playing In Editor Starting")); return; } if (!EventManager.IsValid) { this.ShowNotification(new GUIContent("No FMOD Studio banks loaded. Please check your settings.")); return; } if (Event.current.type == EventType.Layout) { RebuildDisplayFromCache(); } //if (eventStyle == null) { eventStyle = new GUIStyle(GUI.skin.button); eventStyle.normal.background = null; eventStyle.focused.background = null; eventStyle.active.background = null; eventStyle.onFocused.background = null; eventStyle.onNormal.background = null; eventStyle.onHover.background = null; eventStyle.onActive.background = null; eventStyle.stretchWidth = false; eventStyle.padding.left = 0; eventStyle.stretchHeight = false; eventStyle.fixedHeight = eventStyle.lineHeight + eventStyle.margin.top + eventStyle.margin.bottom; eventStyle.alignment = TextAnchor.MiddleLeft; eventIcon = EditorGUIUtility.Load("FMOD/EventIcon.png") as Texture; folderOpenIcon = EditorGUIUtility.Load("FMOD/FolderIconOpen.png") as Texture; folderClosedIcon = EditorGUIUtility.Load("FMOD/FolderIconClosed.png") as Texture; searchIcon = EditorGUIUtility.Load("FMOD/SearchIcon.png") as Texture; bankIcon = EditorGUIUtility.Load("FMOD/BankIcon.png") as Texture; snapshotIcon = EditorGUIUtility.Load("FMOD/SnapshotIcon.png") as Texture; borderIcon = EditorGUIUtility.Load("FMOD/Border.png") as Texture2D; } if (fromInspector) { var border = new GUIStyle(GUI.skin.box); border.normal.background = borderIcon; GUI.Box(new Rect(1, 1, position.width - 1, position.height - 1), GUIContent.none, border); } // Split the window int search box, tree view, preview pane (only if full browser) Rect searchRect, listRect, previewRect; SplitWindow(out searchRect, out listRect, out previewRect); // Scroll the selected item in the tree view - put above the search box otherwise it will take // our key presses #if UNITY_2017_3_OR_NEWER if (selectedItem != null && Event.current.type == EventType.KeyDown) #else if (selectedItem != null && Event.current.type == EventType.keyDown) #endif { if (Event.current.keyCode == KeyCode.UpArrow) { if (selectedItem.Prev != null) { SetSelectedItem(selectedItem.Prev); // make sure it's visible if (selectedItem.Rect.y < treeScroll.y) { treeScroll.y = selectedItem.Rect.y; } } Event.current.Use(); } if (Event.current.keyCode == KeyCode.DownArrow) { if (selectedItem.Next != null) { SetSelectedItem(selectedItem.Next); // make sure it's visible if (selectedItem.Rect.y + selectedItem.Rect.height > treeScroll.y + listRect.height) { treeScroll.y += (selectedItem.Rect.y + selectedItem.Rect.height) - listRect.height; } } Event.current.Use(); } if (Event.current.keyCode == KeyCode.RightArrow) { selectedItem.Expanded = true; Event.current.Use(); } if (Event.current.keyCode == KeyCode.LeftArrow) { selectedItem.Expanded = false; Event.current.Use(); } } // Show the search box at the top GUILayout.BeginArea(searchRect); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent(searchIcon), GUILayout.ExpandWidth(false)); GUI.SetNextControlName("SearchBox"); searchString = EditorGUILayout.TextField(searchString); GUILayout.EndHorizontal(); GUILayout.EndArea(); if (fromInspector) { EditorGUI.FocusTextInControl("SearchBox"); if (selectedItem != null && Event.current.isKey && Event.current.keyCode == KeyCode.Return && !(selectedItem.EventRef == null && selectedItem.BankRef == null)) { Event.current.Use(); if (selectedItem.EventRef != null) { outputProperty.stringValue = ""; outputProperty.stringValue = selectedItem.EventRef.Path; EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, selectedItem.EventRef.Path); } else { outputProperty.stringValue = selectedItem.BankRef.Name; } outputProperty.serializedObject.ApplyModifiedProperties(); Close(); } if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape) { Close(); } } // Show the tree view Predicate <TreeItem> searchFilter = null; searchFilter = (x) => (x.Name.ToLower().Contains(searchString.ToLower()) || x.Children.Exists(searchFilter)); // Check if our selected item still matches the search string if (selectedItem != null && !String.IsNullOrEmpty(searchString) && selectedItem.Children.Count == 0) { Predicate <TreeItem> containsSelected = null; containsSelected = (x) => (x == selectedItem || x.Children.Exists(containsSelected)); Predicate <TreeItem> matchForSelected = null; matchForSelected = (x) => (x.Name.ToLower().Contains(searchString.ToLower()) && (x == selectedItem || x.Children.Exists(containsSelected))) || x.Children.Exists(matchForSelected); if (!treeItems.Exists(matchForSelected)) { SetSelectedItem(null); } } GUILayout.BeginArea(listRect); treeScroll = GUILayout.BeginScrollView(treeScroll, GUILayout.ExpandHeight(true)); lastDrawnItem = null; itemCount = 0; if (showEvents) { treeItems[0].Expanded = fromInspector ? true : treeItems[0].Expanded; ShowEventFolder(treeItems[0], searchFilter); ShowEventFolder(treeItems[1], searchFilter); } if (showBanks) { treeItems[2].Expanded = fromInspector ? true : treeItems[2].Expanded; ShowEventFolder(treeItems[2], searchFilter); } GUILayout.EndScrollView(); GUILayout.EndArea(); // If the standalone event browser show a preview of the selected item if (!fromInspector) { GUI.Box(previewRect, GUIContent.none); if (selectedItem != null && selectedItem.EventRef != null && selectedItem.EventRef.Path.StartsWith("event:")) { PreviewEvent(previewRect, selectedItem.EventRef); } if (selectedItem != null && selectedItem.EventRef != null && selectedItem.EventRef.Path.StartsWith("snapshot:")) { PreviewSnapshot(previewRect, selectedItem.EventRef); } if (selectedItem != null && selectedItem.BankRef != null) { PreviewBank(previewRect, selectedItem.BankRef); } } }
void ShowEventFolder(TreeItem item, Predicate <TreeItem> filter) { eventStyle.padding.left += 17; { // Highlight first found item if (item.EventRef != null || item.BankRef != null) { if (!String.IsNullOrEmpty(searchString) && itemCount == 0 && selectedItem == null ) { SetSelectedItem(item); } itemCount++; } item.Next = null; item.Prev = lastDrawnItem; if (lastDrawnItem != null) { lastDrawnItem.Next = item; } lastDrawnItem = item; } if (item.EventRef != null) { // Rendering and GUI event handling to show an event GUIContent content = new GUIContent(item.Name, item.EventRef.Path.StartsWith("snapshot") ? snapshotIcon : eventIcon); eventStyle.normal.background = selectedItem == item?EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); Event e = Event.current; Rect rect = GUILayoutUtility.GetLastRect(); if (e.type == EventType.MouseDown && e.button == 0 && rect.Contains(e.mousePosition)) { e.Use(); if (fromInspector && e.clickCount >= 2) { outputProperty.stringValue = ""; outputProperty.stringValue = item.EventRef.Path; EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, item.EventRef.Path); outputProperty.serializedObject.ApplyModifiedProperties(); Close(); } SetSelectedItem(item); } #if UNITY_2017_3_OR_NEWER if (e.type == EventType.MouseDrag && rect.Contains(e.mousePosition) && !fromInspector) #else if (e.type == EventType.mouseDrag && rect.Contains(e.mousePosition) && !fromInspector) #endif { DragAndDrop.PrepareStartDrag(); DragAndDrop.objectReferences = new UnityEngine.Object[] { ScriptableObject.Instantiate(item.EventRef) }; DragAndDrop.StartDrag("New FMOD Studio Emitter"); e.Use(); } if (Event.current.type == EventType.Repaint) { item.Rect = rect; } } else if (item.BankRef != null) { // Rendering and event handling for a bank GUIContent content = new GUIContent(item.Name, bankIcon); eventStyle.normal.background = selectedItem == item?EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); Event e = Event.current; Rect rect = GUILayoutUtility.GetLastRect(); if (e.type == EventType.MouseDown && e.button == 0 && rect.Contains(e.mousePosition)) { e.Use(); if (fromInspector && e.clickCount >= 2) { outputProperty.stringValue = item.BankRef.Name; outputProperty.serializedObject.ApplyModifiedProperties(); Close(); } SetSelectedItem(item); } #if UNITY_2017_3_OR_NEWER if (e.type == EventType.MouseDrag && rect.Contains(e.mousePosition) && !fromInspector) #else if (e.type == EventType.mouseDrag && rect.Contains(e.mousePosition) && !fromInspector) #endif { DragAndDrop.PrepareStartDrag(); DragAndDrop.objectReferences = new UnityEngine.Object[] { ScriptableObject.Instantiate(item.BankRef) }; DragAndDrop.StartDrag("New FMOD Studio Bank Loader"); e.Use(); } if (Event.current.type == EventType.Repaint) { item.Rect = rect; } } else { eventStyle.normal.background = selectedItem == item?EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; bool expanded = item.Expanded || !string.IsNullOrEmpty(searchString); GUIContent content = new GUIContent(item.Name, expanded ? folderOpenIcon : folderClosedIcon); GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); Rect rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.current.mousePosition)) { Event.current.Use(); item.Expanded = !item.Expanded; SetSelectedItem(item); } if (item.Expanded || !string.IsNullOrEmpty(searchString)) { item.Children.Sort((a, b) => a.Name.CompareTo(b.Name)); if (item.Name.ToLower().Contains(searchString.ToLower())) { foreach (var childFolder in item.Children) { ShowEventFolder(childFolder, (x) => true); } } else { foreach (var childFolder in item.Children.FindAll(filter)) { ShowEventFolder(childFolder, filter); } } } if (Event.current.type == EventType.Repaint) { item.Rect = rect; } } eventStyle.padding.left -= 17; }
public override void OnInspectorGUI() { var begin = serializedObject.FindProperty("PlayEvent"); var end = serializedObject.FindProperty("StopEvent"); var tag = serializedObject.FindProperty("CollisionTag"); var ev = serializedObject.FindProperty("Event"); var param = serializedObject.FindProperty("Params"); var fadeout = serializedObject.FindProperty("AllowFadeout"); var once = serializedObject.FindProperty("TriggerOnce"); var preload = serializedObject.FindProperty("Preload"); var overrideAtt = serializedObject.FindProperty("OverrideAttenuation"); var minDistance = serializedObject.FindProperty("OverrideMinDistance"); var maxDistance = serializedObject.FindProperty("OverrideMaxDistance"); EditorGUILayout.PropertyField(begin, new GUIContent("Play Event")); EditorGUILayout.PropertyField(end, new GUIContent("Stop Event")); if ((begin.enumValueIndex >= 3 && begin.enumValueIndex <= 6) || (end.enumValueIndex >= 3 && end.enumValueIndex <= 6)) { tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(ev, new GUIContent("Event")); EditorEventRef editorEvent = EventManager.EventFromPath(ev.stringValue); if (EditorGUI.EndChangeCheck()) { EditorUtils.UpdateParamsOnEmitter(serializedObject, ev.stringValue); if (editorEvent != null) { overrideAtt.boolValue = false; minDistance.floatValue = editorEvent.MinDistance; maxDistance.floatValue = editorEvent.MaxDistance; } } // Attenuation if (editorEvent != null) { { EditorGUI.BeginDisabledGroup(editorEvent == null || !editorEvent.Is3D); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Override Attenuation"); EditorGUI.BeginChangeCheck(); overrideAtt.boolValue = EditorGUILayout.Toggle(overrideAtt.boolValue, GUILayout.Width(20)); if (EditorGUI.EndChangeCheck() || (minDistance.floatValue == -1 && maxDistance.floatValue == -1) // never been initialiased ) { minDistance.floatValue = editorEvent.MinDistance; maxDistance.floatValue = editorEvent.MaxDistance; } EditorGUI.BeginDisabledGroup(!overrideAtt.boolValue); EditorGUIUtility.labelWidth = 30; minDistance.floatValue = EditorGUILayout.FloatField("Min", minDistance.floatValue); minDistance.floatValue = Mathf.Clamp(minDistance.floatValue, 0, maxDistance.floatValue); maxDistance.floatValue = EditorGUILayout.FloatField("Max", maxDistance.floatValue); maxDistance.floatValue = Mathf.Max(minDistance.floatValue, maxDistance.floatValue); EditorGUIUtility.labelWidth = 0; EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); } param.isExpanded = EditorGUILayout.Foldout(param.isExpanded, "Initial Parameter Values"); if (ev.hasMultipleDifferentValues) { if (param.isExpanded) { GUILayout.Box("Cannot change parameters when different events are selected", GUILayout.ExpandWidth(true)); } } else { var eventRef = EventManager.EventFromPath(ev.stringValue); if (param.isExpanded && eventRef != null) { foreach (var paramRef in eventRef.Parameters) { bool set; float value; bool matchingSet, matchingValue; CheckParameter(paramRef.Name, out set, out matchingSet, out value, out matchingValue); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(paramRef.Name); EditorGUI.showMixedValue = !matchingSet; EditorGUI.BeginChangeCheck(); bool newSet = EditorGUILayout.Toggle(set, GUILayout.Width(20)); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(serializedObject.isEditingMultipleObjects ? serializedObject.targetObjects : new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); if (newSet) { AddParameterValue(paramRef.Name, paramRef.Default); } else { DeleteParameterValue(paramRef.Name); } set = newSet; } EditorGUI.BeginDisabledGroup(!newSet); if (set) { EditorGUI.showMixedValue = !matchingValue; EditorGUI.BeginChangeCheck(); value = EditorGUILayout.Slider(value, paramRef.Min, paramRef.Max); if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(serializedObject.isEditingMultipleObjects ? serializedObject.targetObjects : new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); SetParameterValue(paramRef.Name, value); } EditorGUI.showMixedValue = false; } else { EditorGUI.showMixedValue = !matchingValue; EditorGUILayout.Slider(paramRef.Default, paramRef.Min, paramRef.Max); EditorGUI.showMixedValue = false; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); } } } fadeout.isExpanded = EditorGUILayout.Foldout(fadeout.isExpanded, "Advanced Controls"); if (fadeout.isExpanded) { EditorGUILayout.PropertyField(preload, new GUIContent("Preload Sample Data")); EditorGUILayout.PropertyField(fadeout, new GUIContent("Allow Fadeout When Stopping")); EditorGUILayout.PropertyField(once, new GUIContent("Trigger Once")); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { var begin = serializedObject.FindProperty("PlayEvent"); var end = serializedObject.FindProperty("StopEvent"); var tag = serializedObject.FindProperty("CollisionTag"); var ev = serializedObject.FindProperty("Event"); var fadeout = serializedObject.FindProperty("AllowFadeout"); var once = serializedObject.FindProperty("TriggerOnce"); var preload = serializedObject.FindProperty("Preload"); var overrideAtt = serializedObject.FindProperty("OverrideAttenuation"); var minDistance = serializedObject.FindProperty("OverrideMinDistance"); var maxDistance = serializedObject.FindProperty("OverrideMaxDistance"); EditorGUILayout.PropertyField(begin, new GUIContent("Play Event")); EditorGUILayout.PropertyField(end, new GUIContent("Stop Event")); if ((begin.enumValueIndex >= (int)EmitterGameEvent.TriggerEnter && begin.enumValueIndex <= (int)EmitterGameEvent.TriggerExit2D) || (end.enumValueIndex >= (int)EmitterGameEvent.TriggerEnter && end.enumValueIndex <= (int)EmitterGameEvent.TriggerExit2D)) { tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(ev, new GUIContent("Event")); EditorEventRef editorEvent = EventManager.EventFromPath(ev.stringValue); if (EditorGUI.EndChangeCheck()) { EditorUtils.UpdateParamsOnEmitter(serializedObject, ev.stringValue); if (editorEvent != null) { overrideAtt.boolValue = false; minDistance.floatValue = editorEvent.MinDistance; maxDistance.floatValue = editorEvent.MaxDistance; } } // Attenuation if (editorEvent != null) { { EditorGUI.BeginDisabledGroup(editorEvent == null || !editorEvent.Is3D); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Override Attenuation"); EditorGUI.BeginChangeCheck(); overrideAtt.boolValue = EditorGUILayout.Toggle(overrideAtt.boolValue, GUILayout.Width(20)); if (EditorGUI.EndChangeCheck() || (minDistance.floatValue == -1 && maxDistance.floatValue == -1) // never been initialiased ) { minDistance.floatValue = editorEvent.MinDistance; maxDistance.floatValue = editorEvent.MaxDistance; } EditorGUI.BeginDisabledGroup(!overrideAtt.boolValue); EditorGUIUtility.labelWidth = 30; minDistance.floatValue = EditorGUILayout.FloatField("Min", minDistance.floatValue); minDistance.floatValue = Mathf.Clamp(minDistance.floatValue, 0, maxDistance.floatValue); maxDistance.floatValue = EditorGUILayout.FloatField("Max", maxDistance.floatValue); maxDistance.floatValue = Mathf.Max(minDistance.floatValue, maxDistance.floatValue); EditorGUIUtility.labelWidth = 0; EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); } parameterValueView.OnGUI(editorEvent, !ev.hasMultipleDifferentValues); fadeout.isExpanded = EditorGUILayout.Foldout(fadeout.isExpanded, "Advanced Controls"); if (fadeout.isExpanded) { EditorGUILayout.PropertyField(preload, new GUIContent("Preload Sample Data")); EditorGUILayout.PropertyField(fadeout, new GUIContent("Allow Fadeout When Stopping")); EditorGUILayout.PropertyField(once, new GUIContent("Trigger Once")); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { var begin = serializedObject.FindProperty("PlayEvent"); var end = serializedObject.FindProperty("StopEvent"); var tag = serializedObject.FindProperty("CollisionTag"); var ev = serializedObject.FindProperty("Event"); var param = serializedObject.FindProperty("Params"); var fadeout = serializedObject.FindProperty("AllowFadeout"); var once = serializedObject.FindProperty("TriggerOnce"); EditorGUILayout.PropertyField(begin, new GUIContent("Play Event")); EditorGUILayout.PropertyField(end, new GUIContent("Stop Event")); if (begin.enumValueIndex == 3 || begin.enumValueIndex == 4 || end.enumValueIndex == 3 || end.enumValueIndex == 4) { tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(ev, new GUIContent("Event")); if (EditorGUI.EndChangeCheck()) { EditorUtils.UpdateParamsOnEmitter(serializedObject, ev.stringValue); } param.isExpanded = EditorGUILayout.Foldout(param.isExpanded, "Initial Parameter Values"); if (ev.hasMultipleDifferentValues) { if (param.isExpanded) { GUILayout.Box("Cannot change parameters when different events are selected", GUILayout.ExpandWidth(true)); } } else { var eventRef = EventManager.EventFromPath(ev.stringValue); if (param.isExpanded && eventRef != null) { foreach (var paramRef in eventRef.Parameters) { bool set; float value; bool matchingSet, matchingValue; CheckParameter(paramRef.Name, out set, out matchingSet, out value, out matchingValue); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(paramRef.Name); EditorGUI.showMixedValue = !matchingSet; EditorGUI.BeginChangeCheck(); bool newSet = EditorGUILayout.Toggle(set, GUILayout.Width(20)); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(serializedObject.isEditingMultipleObjects ? serializedObject.targetObjects : new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); if (newSet) { AddParameterValue(paramRef.Name, paramRef.Default); } else { DeleteParameterValue(paramRef.Name); } set = newSet; } EditorGUI.BeginDisabledGroup(!newSet); if (set) { EditorGUI.showMixedValue = !matchingValue; EditorGUI.BeginChangeCheck(); value = EditorGUILayout.Slider(value, paramRef.Min, paramRef.Max); if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(serializedObject.isEditingMultipleObjects ? serializedObject.targetObjects : new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); SetParameterValue(paramRef.Name, value); } EditorGUI.showMixedValue = false; } else { EditorGUI.showMixedValue = !matchingValue; EditorGUILayout.Slider(paramRef.Default, paramRef.Min, paramRef.Max); EditorGUI.showMixedValue = false; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); } } } fadeout.isExpanded = EditorGUILayout.Foldout(fadeout.isExpanded, "Advanced Controls"); if (fadeout.isExpanded) { EditorGUILayout.PropertyField(fadeout, new GUIContent("Allow Fadeout When Stopping")); EditorGUILayout.PropertyField(once, new GUIContent("Trigger Once")); } serializedObject.ApplyModifiedProperties(); }