Skip to content

Public Node Variables

All blueprint exposed variables in a state class can be made visible in the state machine graph for easy editing. At run-time they'll evaluate any expressions.

Expose Variables

In a state class blueprint, add a variable as you would in any other blueprint and press the public button next to the variable name. Compile your class blueprint and state machine blueprint for the variable to display on the node.

C++ variables need to be marked BlueprintReadWrite or BlueprintReadOnly.

.h
1
2
3
4
5
6
7
/** Variable exposed to blueprints and visible and editable on the state node. */
UPROPERTY(BlueprintReadWrite)
float MyFloatVar;

/** Variable exposed to blueprints and visible on the state node but not editable. */
UPROPERTY(BlueprintReadOnly)
float MyReadOnlyFloatVar;

Setting the meta specifier HideOnNode will always keep a variable from displaying.

.h
1
2
3
/** Variable exposed to blueprints, but not visible on the state node. */
UPROPERTY(BlueprintReadWrite, meta=(HideOnNode))
float MyHiddenFloatVar;

Categories

Categories will automatically be added to the state. Default categories will display first, with all other categories being listed after, in order. Categories can be nested using pipes. For example:

Category A|Nested

Categories

Sorting Variables

Simply rearrange the variables in the blueprint to reorder them on the state.

Logic Driver recognizes DisplayAfter and DisplayPriority meta specifiers.

Variable Graph

Each node made public will be assigned its own blueprint graph when used in a state machine graph.

Double click the property on the node or right click the property on the node and select Go to Property Graph. You can also select Edit Graph from the details panel.

From here you can also place variables from the owning state machine blueprint or define more complex expressions.

Public Var Details Public Var Graph

Graph Evaluation

The default behavior is for variable graphs to evaluate when a state becomes active. When variables evaluate can be configured in the class defaults. State classes can also manually evaluate variables by calling Evaluate Graph Properties.

  • Auto Eval Exposed Properties signals that exposed properties are allowed to evaluate.
  • Eval Default Properties is an optimization for variables that only have a default value entered.

Variable Types

All built and custom variable types should be supported. Default values can be entered for most items, but some types, such as structs won't allow default values to be set and instead need to be wired.

Variable Containers

Arrays

Nodes have special array handling where each element will be assigned a graph.

  • Use the details panel to add or remove elements.
  • If you want to pass in the entire array, you will need to go under the local state graph, call Get Node Instance and set the array from there.

Unsupported Containers

Maps and Sets can't be exposed on the node.

Drag and Drop

Variables or pure return functions within the blueprint can be drag and dropped onto the node. They will be automatically placed and wired on the variable graph.

Custom Node Drag Drop

Default Values

Exposed variables have special handling to automatically read and set default values of the node instance archetype. Generally blueprint pins don't support this behavior.

  • Default values will behave similar to details panel defaults.
    • If the node default value hasn't changed and you adjust the class default value, then the default value will update for the node.
    • Once the node default value has been modified it will no longer be updated if you adjust the class default value.
  • Connecting a blueprint node to the Result pin (such as through drag & drop) will not set a default value. This requires graph evaluation at runtime.
  • Some variables may not allow default editing, such as structs.
Why can't some defaults be edited?

The engine doesn't always have blueprint pins for all types of variables.

If a variable type doesn't allow default values entered when using it as a Setter in a normal blueprint, then it won't allow default values entered in a state node either unless Logic Driver has provided a custom implementation.

Custom Logic Driver Pins

Logic Driver provides custom pins for:

  • Soft Actor References allowing a soft actor reference be picked.
  • Object Pins allowing thumbnails to be viewed and sound files played.

    Thumbnails

Reset to Default

Choosing Reset Property will reset the node default value to current class default value. Updating the class default value will again update the node default value providing it hasn't changed.

Advanced Customization

Change the appearance of the widget, hide variables, or set them to read only.

  1. Click on the variable and configure settings in the variable details window.

    ExposedPropertyOverrides

  1. Add to the ExposedPropertyOverrides array from the C++ constructor.

    YourStateClass.cpp
    UYourStateClass::UYourStateClass()
    {
    #if WITH_EDITORONLY_DATA
        FSMGraphProperty GraphPropertyOverride;
    
        // So the system knows which variable to override.
        GraphPropertyOverride.VariableName = GET_MEMBER_NAME_CHECKED(UYourStateClass, YourVariableName);
    
        // Set minimum width of the default value widget.
        GraphPropertyOverride.WidgetInfo.MinWidth = 450;
    
        // Set read only, this can be changed from construction scripts.
        GraphPropertyOverride.bReadOnly = true;
    
        // Add any variable overrides to the exposed property override array.
        ExposedPropertyOverrides.Add(MoveTemp(GraphPropertyOverride));
    #endif
    }
    
    This will set the class defaults for any derived node class blueprint children.

  1. Under the class default settings of your state class, go to the Properties Category.
  2. Under Exposed Property Overrides add an element and set the Variable Name to the variable you want to override.

Use in 2.7+

This is also available by disabling Enable Variable Customization under Logic Driver project editor settings.

Widget Appearance

Modify the properties under Widget Info to customize how the property should be displayed. Some configuration items may not have an effect on all variable properties and are reserved for special properties, such as TextGraphProperties.

Read Only Variables

Selecting Read Only will prevent instance values from being edited in state machine graphs. You can also mark the variable Blueprint Read Only although this has different effects.(1)

Read only variables won't have their graphs compiled into the final blueprint and won't be evaluated at runtime. Only the values set in the node instance will be used, such as from class defaults or by using the construction script.

    • BlueprintReadOnly specifier can't be modified from construction scripts and prevents all blueprint setters.
    • Read Only through Logic Driver customization only prevents a variable from being edited on the node. It could still be edited through blueprint setters and can be toggled in construction scripts.

Hidden Variables

Setting Hidden will prevent the node instance from displaying the property, but the graph still exists and will be compiled into the blueprint. This can also be toggled through editor construction scripts. (1)

  1. This is not the same as specifying HideOnNode which prevents a variable graph from ever being created and cannot be toggled.

Property Specifiers

See Node Property Specifiers for all supported C++ property specifiers.