public static void DrawTransitionRecord(StateMachineDebugger.TransitionRecord record, bool showGameObject) { string objInfo = record.gameObject.name; string history = record.transition.FromStateName + " -> " + record.transition.ToStateName + " (" + record.transition.TriggerName + ")"; string info = "Index: " + record.index.ToString() + ", Time: " + record.time.ToString(); if (showGameObject) { EditorGUILayout.LabelField(objInfo); } EditorGUILayout.LabelField(history); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(info); if (GUILayout.Button("Track", GUILayout.MaxWidth(100))) { var trackWindow = EditorWindow.GetWindow <TransitionHistoryTrackWindow>(); trackWindow.titleContent = new GUIContent("State track"); trackWindow.SetRecord(record); trackWindow.Show(); } EditorGUILayout.EndHorizontal(); DrawSplitLine(); }
private void DrawStackTrace(StateMachineDebugger.TransitionRecord record) { if (record.index < 0) { return; } try { var trace = record.stackTrace; var frames = trace.GetFrames(); DrawRecordInfo(record); Color defaultColor = GUI.backgroundColor; GUI.backgroundColor = Color.white; StateMachineDebuggerEditorUtil.DrawSplitLine(); GUILayout.BeginVertical(); scrollPos = GUILayout.BeginScrollView(scrollPos); for (int i = START_FRAME_INDEX; i < frames.Length; i++) { DrawStackFrame(frames[i]); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUI.backgroundColor = defaultColor; } catch { } }
private void DrawRecordInfo(StateMachineDebugger.TransitionRecord record) { GUILayout.BeginVertical(); GUILayout.Label("Transition:"); GUILayout.Label(record.transition.FromStateName + " -> " + record.transition.ToStateName + " (" + record.transition.TriggerName + ") "); GUILayout.EndVertical(); }
private void LogStackTrace(StateMachineDebugger.TransitionRecord record) { var trace = record.stackTrace; var frames = trace.GetFrames(); string log = ""; foreach (var frame in frames) { log += "at " + frame.GetMethod().ToString(); log += ", file: " + frame.GetFileName(); log += ", line " + frame.GetFileLineNumber().ToString(); log += "\n"; } Debug.Log(log); }
public void SetRecord(StateMachineDebugger.TransitionRecord record) { this.record = record; }