Navigation
API > API/Plugins > API/Plugins/StateTreeModule
References
| Module | StateTreeModule |
| Header | /Engine/Plugins/Runtime/StateTree/Source/StateTreeModule/Public/StateTreeInstanceData.h |
| Include | #include "StateTreeInstanceData.h" |
Syntax
USTRUCT ()
struct FStateTreeInstanceStorage
Remarks
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.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bIsOwningEventQueue | True if the storage owns the event queue. | |
| TSharedRef< FStateTreeEventQueue > | EventQueue | Events (Transient) | |
| FStateTreeExecutionState | ExecutionState | Execution state of the state tree instance. | |
| FInstancedPropertyBag | GlobalParameters | Global parameters | |
| FInstancedStructContainer | InstanceStructs | Struct instances (Not transient, as we use FStateTreeInstanceData to store default values for instance data) | |
| TArray< FStateTreeTemporaryInstanceData > | TemporaryInstances | Temporary instances | |
| TArray< FStateTreeTransitionRequest > | TransitionRequests | Requested transitions |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FStateTreeInstanceStorage
(
const FStateTreeInstanceStorage& Other |
|||
FStateTreeInstanceStorage
(
FStateTreeInstanceStorage&& Other |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddStructReferencedObjects
(
FReferenceCollector& Collector |
Note, called by FStateTreeInstanceData. | |
| FStructView | AddTemporaryInstance
(
UObject& InOwner, |
Adds temporary instance data associated with specified frame and data handle. | |
| void | AddTransitionRequest
(
const UObject* Owner, |
Buffers a transition request to be sent to the State Tree. | |
| bool | |||
| const FStateTreeEventQueue & | |||
| const FStateTreeExecutionState & | |||
| FConstStructView | |||
| FStateTreeEventQueue & | |||
| FStateTreeExecutionState & | |||
| FStructView | |||
| UObject * | GetMutableObject
(
const int32 Index |
||
| FStructView | GetMutableStruct
(
const int32 Index |
||
| TArrayView< FStateTreeTemporaryInstanceData > | |||
| UObject * | GetMutableTemporaryObject
(
const FStateTreeExecutionFrame& Frame, |
||
| FStructView | GetMutableTemporaryStruct
(
const FStateTreeExecutionFrame& Frame, |
||
| const UObject * | |||
| const TSharedRef< FStateTreeEventQueue > & | |||
| FConstStructView | |||
| TConstArrayView< FStateTreeTransitionRequest > | |||
| bool | |||
| bool | |||
| bool | IsValid () |
||
| bool | IsValidIndex
(
const int32 Index |
||
| bool | IsValidStructIndex
(
const int32 Index |
||
| int32 | Num () |
||
| int32 | NumObjects () |
||
| int32 | NumStructs () |
||
| void | Reset () |
Resets the storage to initial state. | |
| void | Empties the temporary instances. | ||
| void | Reset all pending transition requests. | ||
| void | SetGlobalParameters
(
const FInstancedPropertyBag& Parameters |
Stores copy of provided parameters as State Tree global parameters. | |
| void | SetSharedEventQueue
(
const TSharedRef< FStateTreeEventQueue >& InSharedEventQueue |
Sets event queue from another storage. Marks the event queue not owned. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| FStateTreeInstanceStorage & | operator=
(
const FStateTreeInstanceStorage& Other |
||
| FStateTreeInstanceStorage & | operator=
(
FStateTreeInstanceStorage&& Other |