Debugging Topics

Advanced debugging

We already saw that when you debug an FSM in the blueprint editor, the active state is clearly identified with a red balloon. There are two more balloons you might see:

  • a yellow balloon will list the events that have been queued and deferred by the current state. The age of the event and whether they have expired or not, will also be shown.
  • a green balloon will display user-customizable debug information about the state. This is available only if the state has an implementation class and the class overrides the GetDebugInfo function. During debugging only, the GetDebugInfo function will be invoked every frame while the state is active. If the returned string is not empty, the green balloon will show up with the string contents.
All three debugging balloons visible on this state

Visual Logger

GC FSM sends events to the Visual Logger that is built-in in the Unreal editor. This can be extremely useful to debug FSM when timing is crucial. You can find a description of the Visual Logger in the dedicated documentation page on the Unreal website. GC FSM logs the following events on the logger:

  • Log level:
    • An FSM is started/stopped
    • A state is entered/exited
  • Verbose level:
    • An event causes a transition
    • An event is deferred
    • An event is processed by an internal event handler
  • VeryVerbose level:
    • An event is queued
    • An event is discarded: this case occurs when the event is received, but either the active state does not handle it or the queue policy is “Unique Event: Keep First” and there’s already a matching event in the queue
    • An event is abandoned: this case occurs when an event is initially deferred and inserted in the queue, then the FSM makes a transition to a state that does not handle the event