// Draw the profiler window. private void OnGUI() { if (!EditorApplication.isPlaying) { EditorGUILayoutExtensions.Label("Profiler only active in play mode!"); return; } //Fix null reference exception when launching with profiler is open if (eventTimeline != null) { this.currentFrame = EditorGUILayout.IntSlider(this.currentFrame, 0, this.eventTimeline.Count - 1); scrollOffset = EditorGUILayout.BeginScrollView(scrollOffset); if (this.eventTimeline.Count > this.currentFrame) { for (int i = 0; i < this.eventTimeline[this.currentFrame].Length; i++) { DrawEventButton(this.eventTimeline[this.currentFrame][i], i); } } EditorGUILayout.EndScrollView(); } }
private void DrawEventHeader(TEvent[] EditorEvents) { // Add or remove current event. EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayoutExtensions.Label("Events"); if (EditorEvents != null) { EditorGUI.BeginDisabledGroup(EditorEvents.Length < 1); } if (EditorGUILayoutExtensions.Button("Remove")) { this.myTarget.EditorEvents = RemoveAudioEvent(EditorEvents, this.selectedEventIndex); } if (EditorEvents != null) { EditorGUI.EndDisabledGroup(); } if (EditorGUILayoutExtensions.Button("Add")) { this.myTarget.EditorEvents = AddAudioEvent(EditorEvents); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); }
private void DrawEventHeader(TEvent[] EditorEvents) { // Add or remove current event. EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayoutExtensions.Label("Events"); using (new EditorGUI.DisabledScope((EditorEvents != null) && (EditorEvents.Length < 1))) { if (EditorGUILayoutExtensions.Button("Remove")) { this.MyTarget.EditorEvents = RemoveAudioEvent(EditorEvents, this.selectedEventIndex); } } if (EditorGUILayoutExtensions.Button("Add")) { this.MyTarget.EditorEvents = AddAudioEvent(EditorEvents); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); }