Samples

The nine Feature Samples and what each one shows.

StateFlow comes with nine small sample scenes, one for each core feature. Each has its own graph, prefabs and scripts, and runs on its own.

Importing

  1. Open Window › Package Manager and select StateFlow.
  2. Open the Samples tab and press Import next to Feature Samples.
  3. The samples are copied to Assets/Samples/StateFlow/<version>/Feature Samples.

Open any scene and press Play. To see its graph, select StateFlow Manager in the Hierarchy and press StateFlow Editor. Keep the graph open while you play to watch the flow move.

The samples

SampleShowsRead
01 Getting StartedA StateFlow Manager running a StateFlow Asset: four prefab states wired by their triggers.Getting started
02 LayersScreens, popups, dialogs and alerts, with a live list of what is on each layer.Layers
03 PayloadsA shop passing a ShopItem, then an item and a quantity, from state to state.Payloads
04 TransitionsCross-fade, slide, a curtain on the overlay and a popup that dims the underlay.Transitions
05 Lifecycle and ObserverA log of every lifecycle call and observer notification, in order.Lifecycle, State observer
06 Script StatesA first-run check that picks the first screen, and an async sync step.Script states
07 Sub-States and Linked MachinesA Level sub-state machine with exit states, and a Shop linked from its own asset.Sub-states
08 Toasts and Global TriggersApp-wide events raised from code, routed to an alert and two kinds of toast.Toasts, Global triggers
09 Spawned ContentAn inventory of runtime-spawned slots, and a nested currency bar with its own trigger.Spawned content
01 Getting Started
The Main Menu screen of the Getting Started sample with Play, Settings and Back to Title buttons.
01 Getting Started
02 Layers
A dialog over a popup over the Home screen, with a panel listing each layer's contents.
02 Layers
05 Lifecycle and Observer
A popup over the Alpha screen with a lifecycle log panel.
05 Lifecycle and Observer
08 Toasts and Global Triggers
An achievement toast at the top and a message toast at the bottom over the Home screen.
08 Toasts and Global Triggers

Notes