Navigation
API > API/Plugins > API/Plugins/StateTreeModule
State Tree instance data is used to store the runtime state of a State Tree. It is used together with FStateTreeExecution context to tick the state tree. You are supposed to use FStateTreeInstanceData as a property to store the instance data. That ensures that any UObject references will get GC'd correctly.
The FStateTreeInstanceData wraps FStateTreeInstanceStorage, where the data is actually stored. This indirection is done in order to allow the FStateTreeInstanceData to be bitwise relocatable (e.g. you can put it in an array), and we can still allow delegates to bind to the instance data of individual tasks.
Since the tasks in the instance data are stored in a array that may get resized you will need to use TStateTreeInstanceDataStructRef to reference a struct based task instance data. It is defined below, and has example how to use it. Storage for the actual instance data.
| Name | FStateTreeInstanceStorage |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/StateTreeInstanceData.h |
| Include Path | #include "StateTreeInstanceData.h" |
Syntax
USTRUCT ()
struct FStateTreeInstanceStorage
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FStateTreeInstanceStorage
(
FStateTreeInstanceStorage&& Other |
StateTreeInstanceData.h | ||
FStateTreeInstanceStorage
(
const FStateTreeInstanceStorage& Other |
StateTreeInstanceData.h | ||
| StateTreeInstanceData.h |
Structs
| Name | Remarks |
|---|---|
| FExecutionRuntimeInfo | Info to find the index where the execution runtime data starts for a specific state tree. |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AcquireReadAccess() |
Start the invalid multithreading read-only access detection. | StateTreeInstanceData.h | |
void AcquireWriteAccess() |
Start the invalid multithreading write access detection. | StateTreeInstanceData.h | |
int32 AddExecutionRuntimeData
(
TNotNull< UObject* > Owner, |
Add or reuse the execution runtime data for the state tree. | StateTreeInstanceData.h | |
void AddStructReferencedObjects
(
FReferenceCollector& Collector |
Note, called by FStateTreeInstanceData. | StateTreeInstanceData.h | |
FStructView AddTemporaryInstance
(
UObject& InOwner, |
Adds temporary instance data associated with specified frame and data handle. | StateTreeInstanceData.h | |
void AddTransitionRequest
(
const UObject* Owner, |
Buffers a transition request to be sent to the State Tree. | StateTreeInstanceData.h | |
bool AreAllInstancesValid() |
StateTreeInstanceData.h | ||
uint32 GenerateUniqueId() |
StateTreeInstanceData.h | ||
const FStateTreeEventQueue & GetEventQueue() |
StateTreeInstanceData.h | ||
| StateTreeInstanceData.h | |||
| StateTreeInstanceData.h | |||
const FStateTreeExecutionState & GetExecutionState() |
StateTreeInstanceData.h | ||
FConstStructView GetGlobalParameters() |
StateTreeInstanceData.h | ||
FStateTreeEventQueue & GetMutableEventQueue() |
StateTreeInstanceData.h | ||
FStateTreeExecutionState & GetMutableExecutionState() |
StateTreeInstanceData.h | ||
FStructView GetMutableGlobalParameters() |
StateTreeInstanceData.h | ||
UObject * GetMutableObject
(
const int32 Index |
StateTreeInstanceData.h | ||
FStructView GetMutableStruct
(
const int32 Index |
StateTreeInstanceData.h | ||
TArrayView< FStateTreeTemporaryInstanceData > GetMutableTemporaryInstances() |
StateTreeInstanceData.h | ||
UObject * GetMutableTemporaryObject
(
const FStateTreeExecutionFrame& Frame, |
StateTreeInstanceData.h | ||
FStructView GetMutableTemporaryStruct
(
const FStateTreeExecutionFrame& Frame, |
StateTreeInstanceData.h | ||
const UObject * GetObject
(
const int32 Index |
StateTreeInstanceData.h | ||
UE::StateTree::Debug::FRuntimeValidation GetRuntimeValidation() |
Get the data used at runtime to confirm the inner working of the StateTree. | StateTreeInstanceData.h | |
const TSharedRef< FStateTreeEventQueue > & GetSharedMutableEventQueue() |
StateTreeInstanceData.h | ||
FConstStructView GetStruct
(
const int32 Index |
StateTreeInstanceData.h | ||
TConstArrayView< FStateTreeTransitionRequest > GetTransitionRequests() |
StateTreeInstanceData.h | ||
bool HasBroadcastedDelegates() |
StateTreeInstanceData.h | ||
bool IsDelegateBroadcasted
(
const FStateTreeDelegateDispatcher& Dispatcher |
StateTreeInstanceData.h | ||
bool IsObject
(
const int32 Index |
StateTreeInstanceData.h | ||
bool IsOwningEventQueue() |
StateTreeInstanceData.h | ||
bool IsValidIndex
(
const int32 Index |
StateTreeInstanceData.h | ||
void MarkDelegateAsBroadcasted
(
const FStateTreeDelegateDispatcher& Dispatcher |
Marks delegate as broadcasted. Use for transitions. | StateTreeInstanceData.h | |
int32 Num() |
StateTreeInstanceData.h | ||
void ReleaseReadAccess() |
Stop the multitheading read-only access detection. | StateTreeInstanceData.h | |
void ReleaseWriteAccess() |
Stop the multitheading write access detection. | StateTreeInstanceData.h | |
void Reset() |
Resets the storage to initial state. | StateTreeInstanceData.h | |
void ResetBroadcastedDelegates() |
Resets the list of broadcasted delegates. | StateTreeInstanceData.h | |
void ResetTemporaryInstances() |
Empties the temporary instances. | StateTreeInstanceData.h | |
void ResetTransitionRequests() |
Reset all pending transition requests. | StateTreeInstanceData.h | |
void SetGlobalParameters
(
const FInstancedPropertyBag& Parameters |
Stores copy of provided parameters as State Tree global parameters. | StateTreeInstanceData.h | |
void SetSharedEventQueue
(
const TSharedRef< FStateTreeEventQueue >& InSharedEventQueue |
Sets event queue from another storage. Marks the event queue not owned. | StateTreeInstanceData.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FStateTreeInstanceStorage & operator=
(
const FStateTreeInstanceStorage& Other |
StateTreeInstanceData.h | ||
FStateTreeInstanceStorage & operator=
(
FStateTreeInstanceStorage&& Other |
StateTreeInstanceData.h |