// 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");

            using (new EditorGUI.DisabledScope((EditorEvents != null) && (EditorEvents.Length < 1)))
            {
                if (EditorGUILayoutExtensions.Button("Remove"))
                {
                    this.MyTarget.Events = RemoveAudioEvent(EditorEvents, this.selectedEventIndex);
                }
            }

            if (EditorGUILayoutExtensions.Button("Add"))
            {
                this.MyTarget.Events = AddAudioEvent(EditorEvents);
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }