Skip to content

Preview Mode 2.5+

Preview Mode allows your state machine to run in a single player sandbox world. The goal is to allow simple, isolated state machines to be simulated and tested with an actor context. For other types of contexts, or more complicated systems that require higher levels of integration, it may be more practical to test with PIE (Play In Editor).

Setup

From the state machine blueprint editor, select Preview on the top right.

Add Actor

You will see an empty level. The first thing you want to do is add in an actor which will serve as your context. Select the Add Actor button and choose your actor. The context checkbox next to their name in the outliner will be checked by default on the first actor added. Only one context may be selected at a time.

Once in the level you may position your actor just like you would in the level editor. You can add as many actors as you want to your scene.

Edit Actor

Selecting an actor will let you edit its details. It is possible to reference other actors in the scene when using hard references. You have to select the actor from the drop down list, the picker will not work in the sandbox world.

Edit Simulation Settings

Under the Preview Editor tab you can select the Edit Simulation radio button. From here you can:

  • Select a game mode to use when simulating the preview world.
  • Allow a pawn context to be possessed by a player controller.
  • Edit state machine settings which only impact the simulation world. This is helpful if you want to test different variables on your state machine without changing their real defaults.

Simulate

Pressing the Simulate button will run your simulation. This is similar to starting a PIE session. While running you may adjust properties and positions of the actors. When you stop the simulation they will reset to their original values.

Input

Mouse input is accepted while simulating as long as the preview window is in focus.

If Possess Pawn Context is checked under Edit Simulation, then your context-- providing it's a pawn, will be possessed by your project's default player controller. This allows input actions to be provided to your context or your state machine.

Saving the Preview World

  • Saving the preview world modifies and saves directly to the state machine blueprint.
  • The preview world is not included in release packaging.
  • Not all properties of actors may be saved due to a custom text serializer which saves certain types of properties, such as references. This is to protect against potential circular dependencies which can occur using Unreal's normal object export process.

Considerations

  • Preview mode is designed for simple, non-networked simulations. PIE may be better suited depending on your setup.
  • Soft object references can't be set for the preview world.
  • Hard references require to select the actor from the drop down. The picker will not function.
  • Editing the state machine graph under Preview Mode is the same as editing the graph under Graph Mode.