β¨ Root Object Variable (Blueprint & C++)
Short Description
The UGorgeousRootObjectVariable class serves as the central registry for all object variables within the Gorgeous Things ecosystem. It implements a singleton pattern for global access and provides comprehensive management of object variables.
Long Description
UGorgeousRootObjectVariable is the foundation of the object variable system in Gorgeous Things. As a singleton, it provides a centralized point of access for all object variables, managing their registration, hierarchy, and lifecycle. This class extends the base UGorgeousObjectVariable class with additional functionality specific to the root registry.
π Features
GetRootObjectVariable
Gets the singleton instance of the root object variable, providing global access to the central registry.
| Parameter | Type | Description | 
|---|---|---|
ReturnType | 
UGorgeousRootObjectVariable* | 
The singleton instance of the root object variable. | 
Important
This function is the primary way to access the root object variable. It ensures that only one instance exists throughout the application lifecycle.
UGorgeousRootObjectVariable* RootObjectVariable = UGorgeousRootObjectVariable::GetRootObjectVariable();
// Now you can use the root object variable to create new object variables
FGuid MyNewObjectVariableIdentifier;
UGorgeousObjectVariable* MyNewObjectVariable = RootObjectVariable->NewObjectVariable(UString_SOV::StaticClass(), MyNewObjectVariableIdentifier, nullptr, false);
GetVariableHierarchyRegistry
Retrieves the complete hierarchy registry of all object variables, including those nested within other object variables.
| Parameter | Type | Description | 
|---|---|---|
ReturnType | 
TArray<UGorgeousObjectVariable*> | 
An array containing all registered object variables in the hierarchy. | 
Important
This function returns a flat array of all object variables in the hierarchy, regardless of their nesting level. This is useful for operations that need to process all object variables regardless of their position in the hierarchy.
GetRootVariableRegistry
Retrieves the registry of root-level object variables, which are direct children of the root object variable.
| Parameter | Type | Description | 
|---|---|---|
ReturnType | 
TArray<UGorgeousObjectVariable*> | 
An array containing all root-level object variables. | 
Important
This function returns only the top-level object variables that are direct children of the root object variable. It does not include nested variables.
RemoveVariableFromRegistry
Removes a variable from the registry, effectively unregistering it from the system.
| Parameter | Type | Description | 
|---|---|---|
VariableToRemove | 
UGorgeousObjectVariable* | 
The object variable to remove from the registry. | 
Important
This function exeutes on both the root registry and the registries of all other variables to properly remove the requested object variable from the whole hierarchy.
IsVariableRegistered
Checks if a given object variable is already registered with the registry.
| Parameter | Type | Description | 
|---|---|---|
Variable | 
UGorgeousObjectVariable* | 
The variable to check for existence in the registry. | 
| Parameter | Type | Description | 
|---|---|---|
ReturnType | 
bool | 
True if the variable is registered, false otherwise. | 
Important
This function checks both the root registry and the registries of all other variables to determine if the variable is registered anywhere in the hierarchy.
CleanupRegistry
Cleans up the registry, optionally performing a full cleanup.
| Parameter | Type | Description | 
|---|---|---|
bFullCleanup | 
bool | 
Whether to perform a full cleanup. Defaults to false. | 
Abstract
In most cases you won't even need to call this function, due to that this already happens automatically on every level switch and exit of the game/editor play session.
SetUniversalVariable
Sets the value of a property with any type for an object variable identified by its unique identifier.
Warning
This function is not intended to be called from C++, it should only be used in Blueprint. For a C++ version of this, check out the equivalent SetDynamicProperty function in UGorgeousObjectVariable.
| Parameter | Type | Description | 
|---|---|---|
Identifier | 
FGuid | 
The unique identifier of the object variable. | 
OptionalPropertyName | 
FName | 
The name of the property to set. Defaults to "Value" if not specified. | 
Value | 
int32 | 
The value to set. The actual type depends on the property. | 
Important
This function uses a custom thunk to handle different property types. The actual type of the Value parameter will be determined by the property being set.
GetUniversalVariable
Gets the value of a property with any type from an object variable identified by its unique identifier.
Warning
This function is not intended to be called from C++, it should only be used in Blueprint. For a C++ version of this, check out the equivalent GetDynamicProperty function in UGorgeousObjectVariable.
| Parameter | Type | Description | 
|---|---|---|
Identifier | 
FGuid | 
The unique identifier of the object variable. | 
OptionalPropertyName | 
FName | 
The name of the property to get. Defaults to "Value" if not specified. | 
| Parameter | Type | Description | 
|---|---|---|
OutValue | 
int32 | 
The output value. The actual type depends on the property. | 
Important
This function uses a custom thunk to handle different property types. The actual type of the OutValue parameter will be determined by the property being retrieved.
RegisterWithRegistry
Registers a new object variable with the registry. This is an override of the base class method.
| Parameter | Type | Description | 
|---|---|---|
NewObjectVariable | 
UGorgeousObjectVariable* | 
The object variable to register. | 
Usage
This function is typically called internally by the system when a new UGorgeousObjectVariable is created. However, you might need to call it manually in specific scenarios, such as when re-registering a variable after a specific event.
Variable Properties
| Property | Type | Description | 
|---|---|---|
RootVariableRegistry | 
static TArray<TObjectPtr<UGorgeousObjectVariable>> | 
The registry of root-level object variables. | 
SingletonRootInstance | 
static TObjectPtr<UGorgeousRootObjectVariable> | 
The singleton instance of the root object variable. |