private void RenderEventSettings() { if (InspectorUIUtility.DrawSectionFoldoutWithKey("Events", ShowEventsPrefKey, MixedRealityStylesUtility.BoldTitleFoldoutStyle)) { using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) { EditorGUILayout.PropertyField(serializedObject.FindProperty("OnClick"), OnClickEventLabel); if (InspectorUIUtility.DrawSectionFoldoutWithKey("Receivers", ShowEventReceiversPrefKey, MixedRealityStylesUtility.TitleFoldoutStyle, false)) { SerializedProperty events = serializedObject.FindProperty("Events"); for (int i = 0; i < events.arraySize; i++) { SerializedProperty eventItem = events.GetArrayElementAtIndex(i); if (InteractableEventInspector.RenderEvent(eventItem)) { events.DeleteArrayElementAtIndex(i); // If removed, skip rendering rest of list till next redraw break; } EditorGUILayout.Space(); } if (GUILayout.Button(AddEventReceiverLabel)) { AddEvent(events.arraySize); } } } } }
private void RenderEventSettings() { if (InspectorUIUtility.DrawSectionFoldoutWithKey("Events", ShowEventsPrefKey, MixedRealityStylesUtility.TitleFoldoutStyle)) { EditorGUILayout.Space(); SerializedProperty onClick = serializedObject.FindProperty("OnClick"); EditorGUILayout.PropertyField(onClick, new GUIContent("OnClick")); SerializedProperty events = serializedObject.FindProperty("Events"); for (int i = 0; i < events.arraySize; i++) { SerializedProperty eventItem = events.GetArrayElementAtIndex(i); if (InteractableEventInspector.RenderEvent(eventItem)) { events.DeleteArrayElementAtIndex(i); // If removed, skip rendering rest of list till next redraw break; } EditorGUILayout.Space(); } if (GUILayout.Button(new GUIContent("Add Event"))) { AddEvent(events.arraySize); } } }