Navigation
API > API/Plugins > API/Plugins/StateTreeModule
Stores indexed reference to a instance data struct. The instance data structs may be relocated when the instance data composition changed. For that reason you cannot store pointers to the instance data. This is often needed for example when dealing with delegate lambda's. This helper struct stores data to be able to find the instance data in the instance data array. That way we can access the instance data even of the array changes, and the instance data moves in memory.
Note that the reference is valid only during the lifetime of a task (between a call EnterState() and ExitState()).
You generally do not use this directly, but via FStateTreeExecutionContext.
EStateTreeRunStatus FTestTask::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const { FInstanceDataType& InstanceData = Context.GetInstanceData(*this);
Context.GetWorld()->GetTimerManager().SetTimer( InstanceData.TimerHandle, InstanceDataRef = Context.GetInstanceDataStructRef(this) { if (FInstanceDataType InstanceData = InstanceDataRef.GetPtr()) { ... } }, Delay, true);
return EStateTreeRunStatus::Running; }
| Name | TStateTreeInstanceDataStructRef |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/StateTreeInstanceData.h |
| Include Path | #include "StateTreeInstanceData.h" |
Syntax
template<typename T>
struct TStateTreeInstanceDataStructRef
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
PRAGMA_DISABLE_DEPRECATION_WARNINGS TStateTreeInstanceDataStructRef
(
const TStateTreeInstanceDataStructRef& Other |
StateTreeInstanceData.h | ||
| StateTreeInstanceData.h | |||
TStateTreeInstanceDataStructRef
(
FStateTreeInstanceData& InInstanceData, |
StateTreeInstanceData.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
T * GetPtr() |
StateTreeInstanceData.h | ||
bool IsValid() |
StateTreeInstanceData.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FStructView GetDataView
(
FStateTreeInstanceStorage& Storage, |
StateTreeInstanceData.h | ||
bool IsHandleSourceValid
(
FStateTreeInstanceStorage& Storage, |
StateTreeInstanceData.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TStateTreeInstanceDataStructRef & operator=
(
TStateTreeInstanceDataStructRef const& Other |
StateTreeInstanceData.h | ||
| StateTreeInstanceData.h |