Unreal Engine Integration
Use the UnrealGameState with the UnrealObjectRepository or UnrealObjectRepositoryWithHooks classes found in the Microsoft.XboxStudios.GameStateTracker.Unreal
package.
UnrealObjectRepository requires an implementation of IUnrealConsoleCommandClient. You must either:
- Recommended: Integrate the UnrealToolkit library and use its
UnrealToolkitObjectRepository
implementation. - Write a custom implementation of IUnrealConsoleCommandClient to extract game state.
UnrealObjectRepositoryWithHooks requires an implementation of IUnrealHookClient. This approach is much faster since it allows retrieving many different properties in one request, so it is the default if you integrate UnrealToolkit and use its object repository.
Next, use the game state interface to query for game state. Proceed to Getting Started for more information.
Unreal Object Repository
The following sections explain how the repository is implemented, in case you need to debug, extend, or customize their functionality:
Implementation: Unreal Engine console commands
The base Unreal Engine object repository uses the “obj” and “getall” commands to implement IGameObjectRepository.
- ListGameObjects: obj list class={className} name={objectName}
- The class and object name parameters are optional.
- Another parameter outer={pathName} is useful if multiple objects have the same name.
- GetProperties: getall {className} {propertyName}
- Caveat: Only works when the property exists on the specified class. For example, getall Object Location returns null for every object, even if some objects are Actors and have a Location property.
- A useful command to list properties: listprops {className} *
- The last parameter is a pattern to search for, using asterisks for wildcards.
Implementation: RPC hooks
Unlike Unreal Engine 3, there is no Location property for Actors in Unreal Engine 4 or 5. The GetActorLocation method is the replacement, but the console command interface does not support querying this. Another limitation with console commands is only one property may be retrieved at a time. To support these important features, the “getall” code from Unreal Engine1 was adapted into TDK RPC and Bifrost hooks.
- Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp
This page was last modified on April 04 2024, 06:30 PM (UTC).