๐ŸŒฒ Root Registry

Short Description

Root Object Variables act as top-level registries that own and index all Object Variables in a hierarchy.

Long Description

Each root represents a namespace of Object Variables. Roots provide lookup helpers by name or identifier, maintain ownership for networking, and coordinate orphan handling when parents are removed. Use a root whenever you need a global entry point to your runtime variable tree.

๐Ÿš€ Features

  • Named root registries with a configurable default root.
  • Registry lookups by display name or unique identifier.
  • Orphan handling policies for removed parents.
  • Ownership tokens for network authority coordination.

๐Ÿ“š Usage Examples

UGorgeousRootObjectVariable* Root = UGorgeousRootObjectVariable::GetRootObjectVariable();
TArray<UGorgeousObjectVariable*> AllVariables = UGorgeousRootObjectVariable::GetVariableHierarchyRegistry();

Use Get Root Object Variable to access the registry, then call Find In Registry for named lookups.

GetRootObjectVariable

Returns (or lazily creates) the root registry instance for the requested name. When no name is supplied, the configured default root is used.

Parameter Name Type Description
RootName FName Optional root key; uses default when None.
UGorgeousRootObjectVariable* Root = UGorgeousRootObjectVariable::GetRootObjectVariable(TEXT("Default"));

FindVariableByIdentifier

Resolves a previously assigned FGuid identifier to a registered Object Variable instance.

Parameter Name Type Description
Identifier FGuid Unique variable identifier.
UGorgeousObjectVariable* Found = UGorgeousRootObjectVariable::FindVariableByIdentifier(Identifier);

ClaimRootRegistryOwnership

Grants a stable owner token for a root registry so the networking stack can assign authority consistently.

Parameter Name Type Description
RootName FName Root registry name.
StableIdentifier FString Stable owner identifier (connection or session key).
OwningContext UObject* Object that owns the registry authority.
FGorgeousRootRegistryOwnerHandle Handle = UGorgeousRootObjectVariable::ClaimRootRegistryOwnership(
    TEXT("Default"), TEXT("PlayerOne"), PlayerController
);

Best Practices

  • Create separate roots for systems that must be isolated (e.g., mods vs. core data).
  • Use DisplayName for readable keys and Identifier for stable references in save data.
  • Release ownership handles when a session ends to avoid stale authorities.

Troubleshooting

  • If a root is missing, confirm RootName is registered in developer settings.
  • If an identifier lookup fails, verify the variable is registered and not destroyed.
  • If networking behaves inconsistently, check that registry ownership is claimed and restored correctly.