void OnEventProcessed(DiagnosticEvent diagnosticEvent, bool entryCreated) { if (!CanHandleEvent(diagnosticEvent.Graph)) { return; } bool moveInspectFrame = m_LatestFrame < 0 || m_InspectFrame == m_LatestFrame; m_LatestFrame = diagnosticEvent.Frame; if (entryCreated) { if (m_GraphList != null) { m_GraphList.Reload(); } } if (moveInspectFrame) { SetInspectFrame(m_LatestFrame); } if (diagnosticEvent.Frame != m_lastRepaintedFrame) { Repaint(); m_lastRepaintedFrame = diagnosticEvent.Frame; } }
void DrawToolBar(EventDataPlayerSession session) { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); if (GUILayout.Button("Clear Events", EditorStyles.toolbarButton)) { RegisterEventHandler(false); session.Clear(); m_GraphList?.Reload(); RegisterEventHandler(true); } if (m_GraphList != null && m_GraphList.HasHiddenEvents && GUILayout.Button("Unhide All Hidden Events", EditorStyles.toolbarButton)) { m_GraphList.UnhideAllHiddenEvents(); } GUILayout.FlexibleSpace(); GUILayout.Label(m_InspectFrame == m_LatestFrame ? "Frame: " : "Frame: " + m_InspectFrame + "/" + m_LatestFrame, EditorStyles.miniLabel); using (new EditorGUI.DisabledScope(m_InspectFrame <= 0)) if (GUILayout.Button(m_PrevFrameIcon, EditorStyles.toolbarButton)) { SetInspectFrame(m_InspectFrame - 1); } using (new EditorGUI.DisabledScope(m_InspectFrame >= m_LatestFrame)) if (GUILayout.Button(m_NextFrameIcon, EditorStyles.toolbarButton)) { SetInspectFrame(m_InspectFrame + 1); } if (GUILayout.Button("Current", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { SetInspectFrame(m_LatestFrame); } GUILayout.EndHorizontal(); }
void InitializeGui() { if (m_GraphList == null) { if (m_GraphListTreeViewState == null) { m_GraphListTreeViewState = new TreeViewState(); } var headerState = EventGraphListView.CreateDefaultHeaderState(); if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_GraphListMchs, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(m_GraphListMchs, headerState); } m_GraphListMchs = headerState; m_GraphList = new EventGraphListView(() => { return(activeSession == null ? null : activeSession.RootStreamEntry); }, m_GraphListTreeViewState, m_GraphListMchs, CanHandleEvent, this); InitializeGraphView(m_GraphList); m_GraphList.Reload(); } if (m_EventList == null) { if (m_EventListTreeViewState == null) { m_EventListTreeViewState = new TreeViewState(); } var columns = new List <string>(); var sizes = new List <float>(); OnGetColumns(columns, sizes); var headerState = EventListView.CreateDefaultMultiColumnHeaderState(columns, sizes); if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_EventListMchs, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(m_EventListMchs, headerState); } m_EventListMchs = headerState; m_EventList = new EventListView(m_EventListTreeViewState, m_EventListMchs, DrawColumnCell, OnDisplayEvent); m_EventList.Reload(); } if (m_EventListFrame != m_InspectFrame && m_InspectFrame != m_LatestFrame && !m_DraggingInspectLine && Time.unscaledTime - m_LastEventListUpdate > .25f) { if (activeSession != null) { m_EventList.SetEvents(activeSession.GetFrameEvents(m_InspectFrame)); } m_LastEventListUpdate = Time.unscaledTime; m_EventListFrame = m_InspectFrame; } if (m_GraphListMchs != null && m_GraphListMchs.columns.Length > 2) { string warningText = string.Empty; if (!ProjectConfigData.postProfilerEvents) { warningText = "Warning: Profile events must be enabled in your Addressable Asset settings to view profile data"; } m_GraphListMchs.columns[2].headerContent.text = warningText; } }