Skip to content

USMStateInstance

Module: SMSystem

#include <SMStateInstance.h>

Inherits from USMStateInstance_Base, USMNodeInstance, UObject

Description

class USMStateInstance;

The base class for state nodes. This is where most execution logic should be defined.

Public Functions

Name
USMStateInstance()
void OnStateInitialized()
images/classes/SMStateInstance/img/nd_img_OnStateInitialized.png
void OnStateShutdown()
images/classes/SMStateInstance/img/nd_img_OnStateShutdown.png
void GetAllStateStackInstances(TArray< USMStateInstance_Base * > & StateStackInstances) const
images/classes/SMStateInstance/img/nd_img_GetAllStateStackInstances.png
USMStateInstance_Base * GetStateInStack(int32 Index) const
images/classes/SMStateInstance/img/nd_img_GetStateInStack.png
USMStateInstance_Base * GetStateInStackByClass(TSubclassOf< USMStateInstance > StateClass, bool bIncludeChildren =false) const
images/classes/SMStateInstance/img/nd_img_GetStateInStackByClass.png
USMStateInstance_Base * GetStackOwnerInstance() const
images/classes/SMStateInstance/img/nd_img_GetStackOwnerInstance.png
void GetAllStatesInStackOfClass(TSubclassOf< USMStateInstance > StateClass, TArray< USMStateInstance_Base * > & StateStackInstances, bool bIncludeChildren =false) const
images/classes/SMStateInstance/img/nd_img_GetAllStatesInStackOfClass.png
int32 GetStateIndexInStack(USMStateInstance_Base * StateInstance) const
images/classes/SMStateInstance/img/nd_img_GetStateIndexInStack.png
int32 GetStateStackCount() const
images/classes/SMStateInstance/img/nd_img_GetStateStackCount.png
USMStateInstance * AddStateToStack(TSubclassOf< USMStateInstance > StateClass, int32 StackIndex =-1)
images/classes/SMStateInstance/img/nd_img_AddStateToStack.png
void RemoveStateFromStack(int32 StackIndex =-1)
images/classes/SMStateInstance/img/nd_img_RemoveStateFromStack.png
void ClearStateStack()
images/classes/SMStateInstance/img/nd_img_ClearStateStack.png

Protected Functions

Name
virtual void OnStateInitialized_Implementation()
virtual void OnStateShutdown_Implementation()

Additional inherited members

Public Functions inherited from USMStateInstance_Base

Name
USMStateInstance_Base()
virtual bool IsInEndState() const override
void OnStateBegin()
images/classes/SMStateInstance_Base/img/nd_img_OnStateBegin.png
void OnStateUpdate(float DeltaSeconds)
images/classes/SMStateInstance_Base/img/nd_img_OnStateUpdate.png
void OnStateEnd()
images/classes/SMStateInstance_Base/img/nd_img_OnStateEnd.png
bool IsEndState() const
images/classes/SMStateInstance_Base/img/nd_img_IsEndState.png
void GetStateInfo(FSMStateInfo & State) const
images/classes/SMStateInstance_Base/img/nd_img_GetStateInfo.png
bool IsStateMachine() const
images/classes/SMStateInstance_Base/img/nd_img_IsStateMachine.png
bool IsEntryState() const
images/classes/SMStateInstance_Base/img/nd_img_IsEntryState.png
void SetActive(bool bValue, bool bSetAllParents =false, bool bActivateNow =true)
images/classes/SMStateInstance_Base/img/nd_img_SetActive.png
void EvaluateTransitions()
images/classes/SMStateInstance_Base/img/nd_img_EvaluateTransitions.png
bool GetOutgoingTransitions(TArray< USMTransitionInstance * > & Transitions, bool bExcludeAlwaysFalse =true) const
images/classes/SMStateInstance_Base/img/nd_img_GetOutgoingTransitions.png
bool GetIncomingTransitions(TArray< USMTransitionInstance * > & Transitions, bool bExcludeAlwaysFalse =true) const
images/classes/SMStateInstance_Base/img/nd_img_GetIncomingTransitions.png
USMTransitionInstance * GetTransitionToTake() const
images/classes/SMStateInstance_Base/img/nd_img_GetTransitionToTake.png
bool SwitchToLinkedState(USMStateInstance_Base * NextStateInstance, bool bRequireTransitionToPass =true, bool bActivateNow =true)
images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedState.png
bool SwitchToLinkedStateByName(const FString & NextStateName, bool bRequireTransitionToPass =true, bool bActivateNow =true)
images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedStateByName.png
bool SwitchToLinkedStateByTransition(USMTransitionInstance * TransitionInstance, bool bRequireTransitionToPass =true, bool bActivateNow =true)
images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedStateByTransition.png
bool SwitchToLinkedStateByTransitionName(const FString & TransitionName, bool bRequireTransitionToPass =true, bool bActivateNow =true)
images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedStateByTransitionName.png
USMTransitionInstance * GetTransitionByIndex(int32 Index) const
images/classes/SMStateInstance_Base/img/nd_img_GetTransitionByIndex.png
USMTransitionInstance * GetOutgoingTransitionByName(const FString & Name) const
images/classes/SMStateInstance_Base/img/nd_img_GetOutgoingTransitionByName.png
USMTransitionInstance * GetIncomingTransitionByName(const FString & Name) const
images/classes/SMStateInstance_Base/img/nd_img_GetIncomingTransitionByName.png
USMStateInstance_Base * GetNextStateByTransitionIndex(int32 Index) const
images/classes/SMStateInstance_Base/img/nd_img_GetNextStateByTransitionIndex.png
USMStateInstance_Base * GetNextStateByName(const FString & StateName) const
images/classes/SMStateInstance_Base/img/nd_img_GetNextStateByName.png
USMStateInstance_Base * GetPreviousStateByName(const FString & StateName) const
images/classes/SMStateInstance_Base/img/nd_img_GetPreviousStateByName.png
USMStateInstance_Base * GetPreviousActiveState() const
images/classes/SMStateInstance_Base/img/nd_img_GetPreviousActiveState.png
USMTransitionInstance * GetPreviousActiveTransition() const
images/classes/SMStateInstance_Base/img/nd_img_GetPreviousActiveTransition.png
bool AreAllOutgoingTransitionsFromAnAnyState() const
images/classes/SMStateInstance_Base/img/nd_img_AreAllOutgoingTransitionsFromAnAnyState.png
bool AreAllIncomingTransitionsFromAnAnyState() const
images/classes/SMStateInstance_Base/img/nd_img_AreAllIncomingTransitionsFromAnAnyState.png
const FDateTime & GetStartTime() const
images/classes/SMStateInstance_Base/img/nd_img_GetStartTime.png
float GetServerTimeInState(bool & bOutUsedLocalTime) const
images/classes/SMStateInstance_Base/img/nd_img_GetServerTimeInState.png
void GetAllNodesOfType(TArray< USMNodeInstance * > & OutNodes, TSubclassOf< USMNodeInstance > NodeClass, bool bIncludeChildren =true, const TArray< UClass * > & StopIfTypeIsNot =TArray< UClass * >()) const
const FLinearColor & GetEndStateColor() const
bool ShouldDisplayNameWidget() const
bool ShouldUseDisplayNameOnly() const
const FSMStateConnectionValidator & GetAllowedConnections() const
virtual bool IsRegisteredWithContextMenu() const
virtual bool HideFromContextMenuIfRulesFail() const
bool GetAlwaysUpdate() const
images/classes/SMStateInstance_Base/img/nd_img_GetAlwaysUpdate.png
void SetAlwaysUpdate(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetAlwaysUpdate.png
bool GetDisableTickTransitionEvaluation() const
images/classes/SMStateInstance_Base/img/nd_img_GetDisableTickTransitionEvaluation.png
void SetDisableTickTransitionEvaluation(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetDisableTickTransitionEvaluation.png
bool GetDefaultToParallel() const
images/classes/SMStateInstance_Base/img/nd_img_GetDefaultToParallel.png
void SetDefaultToParallel(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetDefaultToParallel.png
bool GetAllowParallelReentry() const
images/classes/SMStateInstance_Base/img/nd_img_GetAllowParallelReentry.png
void SetAllowParallelReentry(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetAllowParallelReentry.png
bool GetStayActiveOnStateChange() const
images/classes/SMStateInstance_Base/img/nd_img_GetStayActiveOnStateChange.png
void SetStayActiveOnStateChange(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetStayActiveOnStateChange.png
bool GetEvalTransitionsOnStart() const
images/classes/SMStateInstance_Base/img/nd_img_GetEvalTransitionsOnStart.png
void SetEvalTransitionsOnStart(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetEvalTransitionsOnStart.png
bool GetExcludeFromAnyState() const
images/classes/SMStateInstance_Base/img/nd_img_GetExcludeFromAnyState.png
void SetExcludeFromAnyState(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetExcludeFromAnyState.png
bool GetCanBeEndState() const
images/classes/SMStateInstance_Base/img/nd_img_GetCanBeEndState.png
void SetCanBeEndState(const bool bValue)
images/classes/SMStateInstance_Base/img/nd_img_SetCanBeEndState.png
FName GetHideFromContextMenuIfRulesFailPropertyName()
FName GetRegisteredWithContextMenuPropertyName()

Protected Functions inherited from USMStateInstance_Base

Name
virtual void OnStateBegin_Implementation()
virtual void OnStateUpdate_Implementation(float DeltaSeconds)
virtual void OnStateEnd_Implementation()

Public Attributes inherited from USMStateInstance_Base

Name
uint8 bEvalGraphsOnStart
uint8 bEvalGraphsOnUpdate
uint8 bEvalGraphsOnEnd
uint8 bEvalGraphsOnRootStateMachineStart
uint8 bEvalGraphsOnRootStateMachineStop
FOnStateBeginSignature OnStateBeginEvent
FOnStateBeginSignature OnPostStateBeginEvent
FOnStateUpdateSignature OnStateUpdateEvent
FOnStateEndSignature OnStateEndEvent

Protected Attributes inherited from USMStateInstance_Base

Name
FLinearColor NodeEndStateColor
FSMStateConnectionValidator ConnectionRules
uint16 bHideFromContextMenuIfRulesFail
uint16 bRegisterWithContextMenu
uint16 bShowDisplayNameOnly
uint16 bDisplayNameWidget

Friends inherited from USMStateInstance_Base

Name
class USMGraphNode_StateNodeBase

Public Functions inherited from USMNodeInstance

Name
USMNodeInstance()
virtual void Serialize(FArchive & Ar) override
virtual UWorld * GetWorld() const override
virtual void BeginDestroy() override
virtual UObject * GetContext() const override
images/classes/SMNodeInstance/img/nd_img_GetContext.png
virtual void NativeInitialize()
virtual void NativeShutdown()
void OnRootStateMachineStart()
images/classes/SMNodeInstance/img/nd_img_OnRootStateMachineStart.png
void OnRootStateMachineStop()
images/classes/SMNodeInstance/img/nd_img_OnRootStateMachineStop.png
void RunConstructionScript()
bool ShouldSkipNativeEditorConstructionScripts() const
USMInstance * GetStateMachineInstance(bool bTopMostInstance =false) const
images/classes/SMNodeInstance/img/nd_img_GetStateMachineInstance.png
void SetOwningNode(FSMNode_Base * Node, bool bInIsEditorExecution =false)
const FSMNode_Base * GetOwningNode() const
T * GetOwningNodeAs() const
virtual const FSMNode_Base * GetOwningNodeContainer() const
USMStateMachineInstance * GetOwningStateMachineNodeInstance() const
images/classes/SMNodeInstance/img/nd_img_GetOwningStateMachineNodeInstance.png
TScriptInterface< ISMStateMachineNetworkedInterface > GetNetworkInterface() const
images/classes/SMNodeInstance/img/nd_img_GetNetworkInterface.png
virtual float GetTimeInState() const
images/classes/SMNodeInstance/img/nd_img_GetTimeInState.png
virtual bool IsInEndState() const
virtual bool HasUpdated() const
images/classes/SMNodeInstance/img/nd_img_HasUpdated.png
bool IsActive() const
images/classes/SMNodeInstance/img/nd_img_IsActive.png
const FString & GetNodeName() const
images/classes/SMNodeInstance/img/nd_img_GetNodeName.png
const FGuid & GetGuid() const
images/classes/SMNodeInstance/img/nd_img_GetGuid.png
UTexture2D * GetNodeIcon() const
images/classes/SMNodeInstance/img/nd_img_GetNodeIcon.png
FVector2D GetNodeIconSize() const
images/classes/SMNodeInstance/img/nd_img_GetNodeIconSize.png
FLinearColor GetNodeIconTintColor() const
images/classes/SMNodeInstance/img/nd_img_GetNodeIconTintColor.png
void EvaluateGraphProperties(bool bTargetOnly =false)
images/classes/SMNodeInstance/img/nd_img_EvaluateGraphProperties.png
const FGuid & GetTemplateGuid() const
const FVector2D & GetNodePosition() const
images/classes/SMNodeInstance/img/nd_img_GetNodePosition.png
bool IsInitialized() const
images/classes/SMNodeInstance/img/nd_img_IsInitialized.png
bool IsInitializedAndReadyForInputEvents() const
FSMGraphProperty * FindExposedPropertyOverrideByName(const FName & VariableName) const
virtual void PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent) override
bool WasArrayPropertyModified(const FName & PropertyName) const
bool IsNodePinChanging() const
void SetDisplayName(FName NewDisplayName)
images/classes/SMNodeInstance/img/nd_img_SetDisplayName.png
void SetNodeDescriptionText(FText NewDescription)
images/classes/SMNodeInstance/img/nd_img_SetNodeDescriptionText.png
FText GetNodeDescriptionText() const
images/classes/SMNodeInstance/img/nd_img_GetNodeDescriptionText.png
void SetNodeColor(FLinearColor NewColor)
images/classes/SMNodeInstance/img/nd_img_SetNodeColor.png
void SetUseCustomColor(bool bValue)
images/classes/SMNodeInstance/img/nd_img_SetUseCustomColor.png
void SetUseCustomIcon(bool bValue)
images/classes/SMNodeInstance/img/nd_img_SetUseCustomIcon.png
void SetVariableReadOnly(FName VariableName, bool bSetIsReadOnly)
images/classes/SMNodeInstance/img/nd_img_SetVariableReadOnly.png
void SetVariableHidden(FName VariableName, bool bSetHidden)
images/classes/SMNodeInstance/img/nd_img_SetVariableHidden.png
bool IsEditorExecution() const
images/classes/SMNodeInstance/img/nd_img_IsEditorExecution.png
void WithExecutionEnvironment(ESMExecutionEnvironment & ExecutionEnvironment)
images/classes/SMNodeInstance/img/nd_img_WithExecutionEnvironment.png
TScriptInterface< ISMEditorGraphNodeInterface > GetOwningEditorGraphNode() const
images/classes/SMNodeInstance/img/nd_img_GetOwningEditorGraphNode.png
void K2_TryGetOwningEditorGraphNode(TScriptInterface< ISMEditorGraphNodeInterface > & EditorNode, ESMValidEditorNode & IsValidNode) const
images/classes/SMNodeInstance/img/nd_img_K2_TryGetOwningEditorGraphNode.png
bool IsInitializationThreadSafe() const
void ResetVariables()
images/classes/SMNodeInstance/img/nd_img_ResetVariables.png
bool GetResetVariablesOnInitialize() const
bool HasCustomColor() const
const FLinearColor & GetNodeColor() const
const FSMNodeDescription & GetNodeDescription() const
bool HasCustomIcon() const
FString GetNodeDisplayName() const
void SetTemplateGuid(const FGuid & NewTemplateGuid)
void SetIsThreadSafe(bool bNewValue)
void SetIsEditorThreadSafe(const bool bNewValue)
bool GetIsEditorThreadSafe() const
TEnumAsByte< ESMNodeInput::Type > GetInputType() const
int32 GetInputPriority() const
bool GetBlockInput() const
UInputComponent * GetInputComponent() const
images/classes/SMNodeInstance/img/nd_img_GetInputComponent.png
FName GetConstructionScriptFunctionName()
FName GetNodeDescriptionPropertyName()
FName GetHideFromDropDownIfRulesFailPropertyName()

Protected Functions inherited from USMNodeInstance

Name
virtual void OnRootStateMachineStart_Implementation()
virtual void OnRootStateMachineStop_Implementation()
void ConstructionScript()
images/classes/SMNodeInstance/img/nd_img_ConstructionScript.png
FSMGraphProperty * FindOrAddExposedPropertyOverrideByName(const FName & VariableName)
void OnPreCompileValidate(USMCompilerLog * CompilerLog) const
virtual void OnPreCompileValidate_Implementation(USMCompilerLog * CompilerLog) const
virtual void ConstructionScript_Implementation()
virtual UTexture2D * GetNodeIcon_Implementation() const
virtual FVector2D GetNodeIconSize_Implementation() const
virtual FLinearColor GetNodeIconTintColor_Implementation() const
void EnableInput()
Input.
void DisableInput()
void OnContextPawnControllerChanged(APawn * Pawn, AController * NewController)

Public Attributes inherited from USMNodeInstance

Name
TArray< FSMGraphProperty > ExposedPropertyOverrides
uint8 bEvalDefaultProperties
uint8 bAutoEvalExposedProperties

Protected Attributes inherited from USMNodeInstance

Name
bool bSkipNativeEditorConstructionScripts
TObjectPtr< UTexture2D > NodeIcon
FVector2D NodeIconSize
FLinearColor NodeIconTintColor
bool bResetVariablesOnInitialize
FSMNodeDescription NodeDescription
FLinearColor NodeColor
uint8 bDisplayCustomIcon
uint8 bUseCustomColors
uint8 bHideFromDropDownIfRulesFail
TObjectPtr< UInputComponent > InputComponent
TEnumAsByte< ESMNodeInput::Type > AutoReceiveInput
int32 InputPriority
uint8 bBlockInput

Friends inherited from USMNodeInstance

Name
class USMGraphNode_StateNode
class USMGraphNode_TransitionEdge
struct FSMNode_Base(FSMNode_Base )
class USMGraphNode_Base
class USMGraphK2Node_PropertyNode_Base

Public Functions Documentation

function USMStateInstance

USMStateInstance()

function OnStateInitialized

void OnStateInitialized()

images/classes/SMStateInstance/img/nd_img_OnStateInitialized.png

Called before OnStateBegin and before transitions are initialized.


function OnStateShutdown

void OnStateShutdown()

images/classes/SMStateInstance/img/nd_img_OnStateShutdown.png

Called after OnStateEnd and after transitions are shutdown.


function GetAllStateStackInstances

void GetAllStateStackInstances(
    TArray< USMStateInstance_Base * > & StateStackInstances
) const

images/classes/SMStateInstance/img/nd_img_GetAllStateStackInstances.png

Retrieve all state instances in the state stack.

Parameters:

StateStackInstances
[Out] State stack instances in their correct order.

function GetStateInStack

USMStateInstance_Base * GetStateInStack(
    int32 Index
) const

images/classes/SMStateInstance/img/nd_img_GetStateInStack.png

Retrieve a state instance from within the state stack.

Parameters:

Index
the index of the array.

Return: the state if the index is valid.


function GetStateInStackByClass

USMStateInstance_Base * GetStateInStackByClass(
    TSubclassOf< USMStateInstance > StateClass,
    bool bIncludeChildren =false
) const

images/classes/SMStateInstance/img/nd_img_GetStateInStackByClass.png

Retrieve the first stack instance of a given class.

Parameters:

StateClass
The state class to search for.
bIncludeChildren
If children of the given class can be included.

Return: the first state that matches the class.


function GetStackOwnerInstance

USMStateInstance_Base * GetStackOwnerInstance() const

images/classes/SMStateInstance/img/nd_img_GetStackOwnerInstance.png

Retrieve the owning node instance of a state stack. If this is called from the main node instance it will return itself.


function GetAllStatesInStackOfClass

void GetAllStatesInStackOfClass(
    TSubclassOf< USMStateInstance > StateClass,
    TArray< USMStateInstance_Base * > & StateStackInstances,
    bool bIncludeChildren =false
) const

images/classes/SMStateInstance/img/nd_img_GetAllStatesInStackOfClass.png

Retrieve all states that match the given class.

Parameters:

StateClass
The state class to search for.
bIncludeChildren
If children of the given class can be included.
StateStackInstances
[Out] State stack instances matching the given class.

function GetStateIndexInStack

int32 GetStateIndexInStack(
    USMStateInstance_Base * StateInstance
) const

images/classes/SMStateInstance/img/nd_img_GetStateIndexInStack.png

Retrieve the index of a state stack instance. O(n).

Parameters:

StateInstance
The state instance to lookup in the stack.

Return: The index of the state in the stack. -1 if not found or is the base state instance.


function GetStateStackCount

int32 GetStateStackCount() const

images/classes/SMStateInstance/img/nd_img_GetStateStackCount.png

The total number of states in the state stack.


function AddStateToStack

USMStateInstance * AddStateToStack(
    TSubclassOf< USMStateInstance > StateClass,
    int32 StackIndex =-1
)

images/classes/SMStateInstance/img/nd_img_AddStateToStack.png

Add a state to the state stack. For use during editor construction scripts only.

Parameters:

StateClass
The state class to be created.
StackIndex
The index to insert the node stack. Leave at -1 to place at the end.

Return: The stack instance created.


function RemoveStateFromStack

void RemoveStateFromStack(
    int32 StackIndex =-1
)

images/classes/SMStateInstance/img/nd_img_RemoveStateFromStack.png

Remove a state from the stack by index. For use during editor construction scripts only.

Parameters:

StackIndex
The index to remove. Leave at -1 to remove from the end.

function ClearStateStack

void ClearStateStack()

images/classes/SMStateInstance/img/nd_img_ClearStateStack.png

Remove all states from the state stack. For use during editor construction scripts only.


Protected Functions Documentation

function OnStateInitialized_Implementation

inline virtual void OnStateInitialized_Implementation()

function OnStateShutdown_Implementation

inline virtual void OnStateShutdown_Implementation()