Skip to content

USMStateInstance_Base

Module: SMSystem

#include <SMStateInstance.h>

Inherits from USMNodeInstance, UObject

Inherited by USMAnyStateInstance, USMConduitInstance, USMEntryStateInstance, USMStateInstance, USMStateMachineInstance

Description

class USMStateInstance_Base;

[Logic Driver] The abstract base class for all state type nodes including state machine nodes and conduits.

To expose native member properties on the node they must be marked BlueprintReadWrite and not contain the meta keyword HideOnNode.

Public Functions

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

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

Public Attributes

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

Protected Attributes

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

Friends

Name
class USMGraphNode_StateNodeBase

Additional inherited members

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 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_Base

USMStateInstance_Base()

function IsInEndState

virtual bool IsInEndState() const override

Deprecated:

Use either IsEndState() or USMStateMachineInstance::IsStateMachineInEndState() depending on use case.

Reimplements: USMNodeInstance::IsInEndState


function OnStateBegin

void OnStateBegin()

images/classes/SMStateInstance_Base/img/nd_img_OnStateBegin.png

Called when the state is started.


function OnStateUpdate

void OnStateUpdate(
    float DeltaSeconds
)

images/classes/SMStateInstance_Base/img/nd_img_OnStateUpdate.png

Called when the state is updated.

Parameters:

DeltaSeconds
Time delta in seconds from the last update.

function OnStateEnd

void OnStateEnd()

images/classes/SMStateInstance_Base/img/nd_img_OnStateEnd.png

Called when the state is ending. It is not advised to switch states during this event. The state machine will already be in the process of switching states.


function IsEndState

bool IsEndState() const

images/classes/SMStateInstance_Base/img/nd_img_IsEndState.png

If this state is considered an end state.


function GetStateInfo

void GetStateInfo(
    FSMStateInfo & State
) const

images/classes/SMStateInstance_Base/img/nd_img_GetStateInfo.png

Return read only information about the owning state.


function IsStateMachine

bool IsStateMachine() const

images/classes/SMStateInstance_Base/img/nd_img_IsStateMachine.png

Checks if this state is a state machine.


function IsEntryState

bool IsEntryState() const

images/classes/SMStateInstance_Base/img/nd_img_IsEntryState.png

If this state is an entry state within a state machine.


function SetActive

void SetActive(
    bool bValue,
    bool bSetAllParents =false,
    bool bActivateNow =true
)

images/classes/SMStateInstance_Base/img/nd_img_SetActive.png

Force set the active flag of this state. This call is replicated and can be called from the server or from a client. The caller must have state change authority.

When calling from a state, it should be done either OnStateBegin or OnStateUpdate. When calling from a transition it should be done from OnTransitionEntered and limited to the previous state. If this is called from other state or transition methods it may cause issues with the normal update cycle of a state machine.

Parameters:

bValue
True activates the state, false deactivates the state.
bSetAllParents
Sets the active state of all super state machines. A parent state machine won't be deactivated unless there are no other states active.
bActivateNow
If the state is becoming active it will fully activate and run OnStateBegin this tick. If this is false it will do so on the next update cycle.

function EvaluateTransitions

void EvaluateTransitions()

images/classes/SMStateInstance_Base/img/nd_img_EvaluateTransitions.png

Signals to the owning state machine to process transition evaluation. This is similar to calling Update on the owner root state machine, however state update logic (Tick) won't execute. All transitions are evaluated as normal starting from the root state machine down. Depending on super state transitions it's possible the state machine this state is part of may exit.


function GetOutgoingTransitions

bool GetOutgoingTransitions(
    TArray< USMTransitionInstance * > & Transitions,
    bool bExcludeAlwaysFalse =true
) const

images/classes/SMStateInstance_Base/img/nd_img_GetOutgoingTransitions.png

Return all outgoing transition instances.

Parameters:

Transitions
The outgoing transitions.
bExcludeAlwaysFalse
Skip over transitions that can't ever be true.

Return: True if any transitions exist.


function GetIncomingTransitions

bool GetIncomingTransitions(
    TArray< USMTransitionInstance * > & Transitions,
    bool bExcludeAlwaysFalse =true
) const

images/classes/SMStateInstance_Base/img/nd_img_GetIncomingTransitions.png

Return all incoming transition instances.

Parameters:

Transitions
The incoming transitions.
bExcludeAlwaysFalse
Skip over transitions that can't ever be true.

Return: True if any transitions exist.


function GetTransitionToTake

USMTransitionInstance * GetTransitionToTake() const

images/classes/SMStateInstance_Base/img/nd_img_GetTransitionToTake.png

The transition this state will be taking. Generally only valid during OnStateEnd and if this state isn't an end state. May be null.


function SwitchToLinkedState

bool SwitchToLinkedState(
    USMStateInstance_Base * NextStateInstance,
    bool bRequireTransitionToPass =true,
    bool bActivateNow =true
)

images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedState.png

Forcibly move to the next state providing this state is active and a transition is directly connecting the states.

This should be done either OnStateBegin or OnStateUpdate. If this is called from other state methods it may cause issues with the normal update cycle of a state machine.

Parameters:

NextStateInstance
The state node instance to switch to.
bRequireTransitionToPass
Will evaluate the transition and only switch states if it passes.
bActivateNow
If the state switches the destination state will activate and run OnStateBegin this tick. Otherwise, it will do so in the next update cycle.

Return: True if the active state was switched.


function SwitchToLinkedStateByName

bool SwitchToLinkedStateByName(
    const FString & NextStateName,
    bool bRequireTransitionToPass =true,
    bool bActivateNow =true
)

images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedStateByName.png

Forcibly move to the next state providing this state is active and a transition is directly connecting the states.

This should be done either OnStateBegin or OnStateUpdate. If this is called from other state methods it may cause issues with the normal update cycle of a state machine.

Parameters:

NextStateName
The name of the state to switch to.
bRequireTransitionToPass
Will evaluate the transition and only switch states if it passes.
bActivateNow
If the state switches the destination state will activate and run OnStateBegin this tick. Otherwise, it will do so in the next update cycle.

Return: True if the active state was switched.


function SwitchToLinkedStateByTransition

bool SwitchToLinkedStateByTransition(
    USMTransitionInstance * TransitionInstance,
    bool bRequireTransitionToPass =true,
    bool bActivateNow =true
)

images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedStateByTransition.png

Forcibly move to the next state providing this state is active and a transition is directly connecting the states.

This should be done either OnStateBegin or OnStateUpdate. If this is called from other state methods it may cause issues with the normal update cycle of a state machine.

Parameters:

TransitionInstance
The transition which should be taken to the next state.
bRequireTransitionToPass
Will evaluate the transition and only switch states if it passes.
bActivateNow
If the state switches the destination state will activate and run OnStateBegin this tick. Otherwise, it will do so in the next update cycle.

Return: True if the active state was switched.


function SwitchToLinkedStateByTransitionName

bool SwitchToLinkedStateByTransitionName(
    const FString & TransitionName,
    bool bRequireTransitionToPass =true,
    bool bActivateNow =true
)

images/classes/SMStateInstance_Base/img/nd_img_SwitchToLinkedStateByTransitionName.png

Forcibly move to the next state providing this state is active and a transition is directly connecting the states.

This should be done either OnStateBegin or OnStateUpdate. If this is called from other state methods it may cause issues with the normal update cycle of a state machine.

Parameters:

TransitionName
The outgoing transition name which should be taken to the next state.
bRequireTransitionToPass
Will evaluate the transition and only switch states if it passes.
bActivateNow
If the state switches the destination state will activate and run OnStateBegin this tick. Otherwise, it will do so in the next update cycle.

Return: True if the active state was switched.


function GetTransitionByIndex

USMTransitionInstance * GetTransitionByIndex(
    int32 Index
) const

images/classes/SMStateInstance_Base/img/nd_img_GetTransitionByIndex.png

Return an outgoing transition given the transition index.

Parameters:

Index
The array index of the transition. If transitions have manual priorities they should correlate with the index value.

Return: The transition or nullptr.


function GetOutgoingTransitionByName

USMTransitionInstance * GetOutgoingTransitionByName(
    const FString & Name
) const

images/classes/SMStateInstance_Base/img/nd_img_GetOutgoingTransitionByName.png

Return a transition given its name. O(n) by number of outgoing transitions.

Parameters:

Name
The name of the transition. The name is auto-generated by default.

Return: The transition or nullptr.


function GetIncomingTransitionByName

USMTransitionInstance * GetIncomingTransitionByName(
    const FString & Name
) const

images/classes/SMStateInstance_Base/img/nd_img_GetIncomingTransitionByName.png

Return an incoming transition given its name. O(n) by number of incoming transitions.

Parameters:

Name
The name of the transition. The name is auto-generated by default.

Return: The transition or nullptr.


function GetNextStateByTransitionIndex

USMStateInstance_Base * GetNextStateByTransitionIndex(
    int32 Index
) const

images/classes/SMStateInstance_Base/img/nd_img_GetNextStateByTransitionIndex.png

Return the next connected state given a transition index.

Parameters:

Index
The array index of the transition. If transitions have manual priorities they should correlate with the index value.

Return: The connected state or nullptr.


function GetNextStateByName

USMStateInstance_Base * GetNextStateByName(
    const FString & StateName
) const

images/classes/SMStateInstance_Base/img/nd_img_GetNextStateByName.png

Return the next state connected by an outgoing transition. O(n) by number of transitions.

Parameters:

StateName
Name of the state to search for.

Return: The connected state or nullptr.


function GetPreviousStateByName

USMStateInstance_Base * GetPreviousStateByName(
    const FString & StateName
) const

images/classes/SMStateInstance_Base/img/nd_img_GetPreviousStateByName.png

Return a previous state connected through an incoming transition. O(n) by number of transitions.

Parameters:

StateName
Name of the state to search for.

Return: The connected state or nullptr.


function GetPreviousActiveState

USMStateInstance_Base * GetPreviousActiveState() const

images/classes/SMStateInstance_Base/img/nd_img_GetPreviousActiveState.png

Retrieve the last active state that transitioned to this state. This will not count transition conduits.

Return: The state instance last active before this state became active. May be nullptr.


function GetPreviousActiveTransition

USMTransitionInstance * GetPreviousActiveTransition() const

images/classes/SMStateInstance_Base/img/nd_img_GetPreviousActiveTransition.png

Retrieve the last transition taken to this state.

Return: The transition instance last active before this state became active. May be nullptr.


function AreAllOutgoingTransitionsFromAnAnyState

bool AreAllOutgoingTransitionsFromAnAnyState() const

images/classes/SMStateInstance_Base/img/nd_img_AreAllOutgoingTransitionsFromAnAnyState.png

Checks if every outgoing transition was created by an Any State.


function AreAllIncomingTransitionsFromAnAnyState

bool AreAllIncomingTransitionsFromAnAnyState() const

images/classes/SMStateInstance_Base/img/nd_img_AreAllIncomingTransitionsFromAnAnyState.png

Checks if every incoming transition was created by an Any State.


function GetStartTime

const FDateTime & GetStartTime() const

images/classes/SMStateInstance_Base/img/nd_img_GetStartTime.png

Retrieve the UTC time when the state last started. If this is called before the state has started once, or before initialization (such as during an editor construction script) the datetime will be initialized to 0.

Return: DateTime in UTC. This is when the state started locally and won't be in sync with the server.


function GetServerTimeInState

float GetServerTimeInState(
    bool & bOutUsedLocalTime
) const

images/classes/SMStateInstance_Base/img/nd_img_GetServerTimeInState.png

Retrieve the time the server spent in the state. This is retrieved from network transactions and can match the TimeInState from the server.

This will only match the server after OnStateEnd() is called and provided the client received the replicated transition. When using client state change authority, USMStateMachineComponent::bWaitForTransactionsFromServer must be set to true for the client to receive the updated server time.

When the server time can't be calculated the local time will be returned instead, using GetTimeInState().

The return value is impacted by bCalculateServerTimeForClients of the state machine component's network settings, and whether the state machine is networked, a client or server, or is ticking.

Parameters:

bOutUsedLocalTime
[Out] Indicates that local time from GetTimeInState() was used.

Return: The total time spent in the state, either matching the server or the current local time spent.


function GetAllNodesOfType

void GetAllNodesOfType(
    TArray< USMNodeInstance * > & OutNodes,
    TSubclassOf< USMNodeInstance > NodeClass,
    bool bIncludeChildren =true,
    const TArray< UClass * > & StopIfTypeIsNot =TArray< UClass * >()
) const

Recursively search connected nodes for nodes matching the given type.

Parameters:

OutNodes
All found nodes.
NodeClass
The class type to search for.
bIncludeChildren
Include children of type NodeClass or require an exact match.
StopIfTypeIsNot
The search is broken when a node's type is not found in this list. Leave empty to never break the search.

function GetEndStateColor

inline const FLinearColor & GetEndStateColor() const

function ShouldDisplayNameWidget

inline bool ShouldDisplayNameWidget() const

function ShouldUseDisplayNameOnly

inline bool ShouldUseDisplayNameOnly() const

function GetAllowedConnections

inline const FSMStateConnectionValidator & GetAllowedConnections() const

function IsRegisteredWithContextMenu

virtual bool IsRegisteredWithContextMenu() const

Deprecated:

This function is no longer used. Set bRegisterWithContextMenu from the C++ constructor or use the NotPlaceable UClass specifier to prevent registration.


function HideFromContextMenuIfRulesFail

inline virtual bool HideFromContextMenuIfRulesFail() const

Deprecated:

This function is no longer used. Set bHideFromContextMenuIfRulesFail from the C++ constructor instead.


function GetAlwaysUpdate

bool GetAlwaysUpdate() const

images/classes/SMStateInstance_Base/img/nd_img_GetAlwaysUpdate.png

Public getter for bAlwaysUpdate.


function SetAlwaysUpdate

void SetAlwaysUpdate(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetAlwaysUpdate.png

Public setter for bAlwaysUpdate.


function GetDisableTickTransitionEvaluation

bool GetDisableTickTransitionEvaluation() const

images/classes/SMStateInstance_Base/img/nd_img_GetDisableTickTransitionEvaluation.png

Public getter for bDisableTickTransitionEvaluation.


function SetDisableTickTransitionEvaluation

void SetDisableTickTransitionEvaluation(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetDisableTickTransitionEvaluation.png

Public setter for bDisableTickTransitionEvaluation.


function GetDefaultToParallel

inline bool GetDefaultToParallel() const

images/classes/SMStateInstance_Base/img/nd_img_GetDefaultToParallel.png

Public getter for bDefaultToParallel. Only valid for the editor.


function SetDefaultToParallel

void SetDefaultToParallel(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetDefaultToParallel.png

Public setter for bDefaultToParallel. Only valid from the editor construction script.


function GetAllowParallelReentry

bool GetAllowParallelReentry() const

images/classes/SMStateInstance_Base/img/nd_img_GetAllowParallelReentry.png

Public setter for bAllowParallelReentry.


function SetAllowParallelReentry

void SetAllowParallelReentry(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetAllowParallelReentry.png

Public setter for bAllowParallelReentry.


function GetStayActiveOnStateChange

bool GetStayActiveOnStateChange() const

images/classes/SMStateInstance_Base/img/nd_img_GetStayActiveOnStateChange.png

Public setter for bStayActiveOnStateChange.


function SetStayActiveOnStateChange

void SetStayActiveOnStateChange(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetStayActiveOnStateChange.png

Public setter for bStayActiveOnStateChange.


function GetEvalTransitionsOnStart

bool GetEvalTransitionsOnStart() const

images/classes/SMStateInstance_Base/img/nd_img_GetEvalTransitionsOnStart.png

Public setter for bEvalTransitionsOnStart.


function SetEvalTransitionsOnStart

void SetEvalTransitionsOnStart(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetEvalTransitionsOnStart.png

Public setter for bEvalTransitionsOnStart.


function GetExcludeFromAnyState

inline bool GetExcludeFromAnyState() const

images/classes/SMStateInstance_Base/img/nd_img_GetExcludeFromAnyState.png

Public getter for bExcludeFromAnyState. Only valid for the editor.


function SetExcludeFromAnyState

void SetExcludeFromAnyState(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetExcludeFromAnyState.png

Public setter for bExcludeFromAnyState. Only valid from the editor construction script.


function GetCanBeEndState

bool GetCanBeEndState() const

images/classes/SMStateInstance_Base/img/nd_img_GetCanBeEndState.png

Public setter for bCanBeEndState.


function SetCanBeEndState

void SetCanBeEndState(
    const bool bValue
)

images/classes/SMStateInstance_Base/img/nd_img_SetCanBeEndState.png

Public setter for bCanBeEndState.


function GetHideFromContextMenuIfRulesFailPropertyName

static inline FName GetHideFromContextMenuIfRulesFailPropertyName()

function GetRegisteredWithContextMenuPropertyName

static inline FName GetRegisteredWithContextMenuPropertyName()

Protected Functions Documentation

function OnStateBegin_Implementation

inline virtual void OnStateBegin_Implementation()

function OnStateUpdate_Implementation

inline virtual void OnStateUpdate_Implementation(
    float DeltaSeconds
)

function OnStateEnd_Implementation

inline virtual void OnStateEnd_Implementation()

Public Attributes Documentation

variable bEvalGraphsOnStart

uint8 bEvalGraphsOnStart;

Should graph properties evaluate when initializing or on state start.


variable bEvalGraphsOnUpdate

uint8 bEvalGraphsOnUpdate;

Should graph properties evaluate on state update.


variable bEvalGraphsOnEnd

uint8 bEvalGraphsOnEnd;

Should graph properties evaluate on state end.


variable bEvalGraphsOnRootStateMachineStart

uint8 bEvalGraphsOnRootStateMachineStart;

Should graph properties evaluate when the root state machine starts.


variable bEvalGraphsOnRootStateMachineStop

uint8 bEvalGraphsOnRootStateMachineStop;

Should graph properties evaluate when the root state machine stops.


variable OnStateBeginEvent

FOnStateBeginSignature OnStateBeginEvent;

Called right before the state has started. This is meant for an observer to be aware of when a state is about to start. This will only be called for state stack instances if the state is allowed to execute logic. Do not change states from within this event, the state change process will still be in progress.


variable OnPostStateBeginEvent

FOnStateBeginSignature OnPostStateBeginEvent;

Called right after the state has started. This is meant for an observer to be aware of when a state has started. If you need to change states this event is safer to use, but ideally state changes should be managed by transitions or from within the state.

This will only be called for state stack instances if the state is allowed to execute logic, and will be called before the primary instance's OnPostStateBeginEvent. It is not safe to change states from this event when broadcast from a state stack instance.


variable OnStateUpdateEvent

FOnStateUpdateSignature OnStateUpdateEvent;

Called before the state has updated. This is meant for an observer to be aware of when a state is updating and it is not advised to switch states from this event.


variable OnStateEndEvent

FOnStateEndSignature OnStateEndEvent;

Called before the state has ended. It is not advised to switch states during this event. The state machine will already be in the process of switching states.


Protected Attributes Documentation

variable NodeEndStateColor

FLinearColor NodeEndStateColor;

The color this node should be when it is an end state.


variable ConnectionRules

FSMStateConnectionValidator ConnectionRules;

Define what types of connections are allowed. Default is all.


variable bHideFromContextMenuIfRulesFail

uint16 bHideFromContextMenuIfRulesFail;

Restrict placement unless rules can be verified. Ex: If the rule says this can only be connected from a state node, then this won't show in the context menu unless dragging from a state node.


variable bRegisterWithContextMenu

uint16 bRegisterWithContextMenu;

Allows this node to be displayed in the graph context menu when placing nodes.


variable bShowDisplayNameOnly

uint16 bShowDisplayNameOnly;

When true only the Name set above will be displayed. The node cannot be renamed. This allows duplicate names to be displayed in the same graph. The node's internal name and local graph name will still be unique.


variable bDisplayNameWidget

uint16 bDisplayNameWidget;

Whether the name of this state should be visible on the node. It can still be changed in the details panel or by renaming the state graph.


Private Attributes Documentation

variable bDisableTickTransitionEvaluation

uint16 bDisableTickTransitionEvaluation;

Prevents conditional transitions for this state from being evaluated on Tick. This is good to use if the transitions leading out of the state are event based or if you are manually calling EvaluateTransitions from a state instance.


variable bEvalTransitionsOnStart

uint16 bEvalTransitionsOnStart;

When true and a state is started OnStateBegin fires and then transitions are evaluated in the same tick. When false and a state is started OnStateBegin fires on the first tick and transitions are evaluated on the second tick.

This can be chained with other nodes that have this checked making it possible to evaluate multiple nodes and transitions in a single tick.

When using this consider performance implications and any potential infinite loops such as if you are using a self transition on this state.

Individual transitions can modify this behavior with bCanEvalWithStartState.


variable bAlwaysUpdate

uint16 bAlwaysUpdate;

Always update the state at least once before ending.


variable bCanBeEndState

uint16 bCanBeEndState;

If this state is allowed to ever be considered an end state. Disabling this will prevent a state machine that is configured to stop on end state from stopping when reaching this state, even if this state is technically an end state.


variable bDefaultToParallel

uint16 bDefaultToParallel;

Sets all current and future transitions from this state to run in parallel. Conduit nodes are not supported.


variable bAllowParallelReentry

uint16 bAllowParallelReentry;

If this state can be reentered from a parallel state if this state is already active. This will not call On State End but will call On State Begin.


variable bStayActiveOnStateChange

uint16 bStayActiveOnStateChange;

If the state should remain active even after a transition is taken from this state.


variable bExcludeFromAnyState

uint16 bExcludeFromAnyState;

Prevents the Any State node from adding transitions to this node. This can be useful for maintaining end states.


Friends

friend USMGraphNode_StateNodeBase

friend class USMGraphNode_StateNodeBase(
    USMGraphNode_StateNodeBase 
);