Skip to content

USMBlueprintUtils

Module: SMSystem

#include <SMUtils.h>

Inherits from UBlueprintFunctionLibrary

Description

class USMBlueprintUtils;

General Blueprint helpers for creating state machines.

Public Functions

Name
USMInstance * CreateStateMachineInstance(TSubclassOf< USMInstance > StateMachineClass, UObject * Context, bool bInitializeNow =true)
USMInstance * CreateStateMachineInstanceAsync(TSubclassOf< USMInstance > StateMachineClass, UObject * Context, const FOnStateMachineInstanceInitializedAsync & OnCompletedDelegate)
USMInstance * K2_CreateStateMachineInstance(TSubclassOf< USMInstance > StateMachineClass, UObject * Context, bool bInitializeNow =true)
images/classes/SMBlueprintUtils/img/nd_img_K2_CreateStateMachineInstance.png
USMInstance * K2_CreateStateMachineInstanceAsync(TSubclassOf< USMInstance > StateMachineClass, UObject * Context, FLatentActionInfo LatentInfo)
images/classes/SMBlueprintUtils/img/nd_img_K2_CreateStateMachineInstanceAsync.png
USMInstance * K2_CreateStateMachineInstancePure(TSubclassOf< USMInstance > StateMachineClass, UObject * Context, bool bInitializeNow =true)
USMInstance * CreateStateMachineInstanceFromTemplate(TSubclassOf< USMInstance > StateMachineClass, UObject * Context, USMInstance * Template, bool bInitializeNow =true)
images/classes/SMBlueprintUtils/img/nd_img_CreateStateMachineInstanceFromTemplate.png

Public Functions Documentation

function CreateStateMachineInstance

static USMInstance * CreateStateMachineInstance(
    TSubclassOf< USMInstance > StateMachineClass,
    UObject * Context,
    bool bInitializeNow =true
)

Create a new state machine instance initialized with the given context. The state machine is instantiated with the Context as the outer object.

Parameters:

StateMachineClass
The class of the state machine to be instantiated.
Context
The context object this state machine will run for. Often an actor.
bInitializeNow
If the Initialize method should be called. Initialize must be called before the state machine can be started.

Return: The state machine instance created.


function CreateStateMachineInstanceAsync

static USMInstance * CreateStateMachineInstanceAsync(
    TSubclassOf< USMInstance > StateMachineClass,
    UObject * Context,
    const FOnStateMachineInstanceInitializedAsync & OnCompletedDelegate
)

Create and initialize a new state machine instance with the given context. The state machine is instantiated with the Context as the outer object. Initialize is automatically run on a separate thread.

Parameters:

StateMachineClass
The class of the state machine to be instantiated.
Context
The context object this state machine will run for. Often an actor.
OnCompletedDelegate
Delegate to assign which is called when the process completes.

Return: The state machine instance created. It will not be initialized at the time of function return.


function K2_CreateStateMachineInstance

static USMInstance * K2_CreateStateMachineInstance(
    TSubclassOf< USMInstance > StateMachineClass,
    UObject * Context,
    bool bInitializeNow =true
)

images/classes/SMBlueprintUtils/img/nd_img_K2_CreateStateMachineInstance.png

Create a new state machine instance initialized with the given context. The state machine is instantiated with the Context as the outer object.

Parameters:

StateMachineClass
The class of the state machine to be instantiated.
Context
The context object this state machine will run for. Often an actor.
bInitializeNow
If the Initialize method should be called. Initialize must be called before the state machine can be started.

Return: The state machine instance created.


function K2_CreateStateMachineInstanceAsync

static USMInstance * K2_CreateStateMachineInstanceAsync(
    TSubclassOf< USMInstance > StateMachineClass,
    UObject * Context,
    FLatentActionInfo LatentInfo
)

images/classes/SMBlueprintUtils/img/nd_img_K2_CreateStateMachineInstanceAsync.png

Create and initialize a new state machine instance with the given context. The state machine is instantiated with the Context as the outer object. Initialize is automatically run on a separate thread.

Parameters:

StateMachineClass
The class of the state machine to be instantiated.
Context
The context object this state machine will run for. Often an actor.

Return: The state machine instance created.


function K2_CreateStateMachineInstancePure

static USMInstance * K2_CreateStateMachineInstancePure(
    TSubclassOf< USMInstance > StateMachineClass,
    UObject * Context,
    bool bInitializeNow =true
)

Create a new state machine instance initialized with the given context. The state machine is instantiated with the Context as the outer object.

This is a legacy pure node and the execution version Create State Machine Instance should be used instead.

Parameters:

StateMachineClass
The class of the state machine to be instantiated.
Context
The context object this state machine will run for. Often an actor.
bInitializeNow
If the Initialize method should be called. Initialize must be called before the state machine can be started.

Deprecated:

This function is deprecated. Use the execution version of CreateStateMachineInstance instead.

Return: The state machine instance created.

Warning:

Every pin you split from here will create and initialize a new instance!


function CreateStateMachineInstanceFromTemplate

static USMInstance * CreateStateMachineInstanceFromTemplate(
    TSubclassOf< USMInstance > StateMachineClass,
    UObject * Context,
    USMInstance * Template,
    bool bInitializeNow =true
)

images/classes/SMBlueprintUtils/img/nd_img_CreateStateMachineInstanceFromTemplate.png

Create a new state machine instance from a template initialized with the given context. The state machine is instantiated with the Context as the outer object.

Parameters:

StateMachineClass
The class of the state machine to be instantiated.
Context
The context object this state machine will run for. Often an actor.
Template
A template archetype for setting initial property values of the state machine instance.
bInitializeNow
If the Initialize method should be called. Initialize must be called before the state machine can be started.

Return: The state machine instance created.

Todo:

This function is intended to be deprecated and instead rely on the engine's NewObject<> for templates, but there isn't a good replacement for existing BP usage.

Warning:

Every pin you split from here will create and initialize a new instance!