Navigation
API > API/Plugins > API/Plugins/SignificanceManager
The significance manager provides a framework for registering objects by tag to each have a significance value calculated from which a game specific subclass and game logic can make decisions about what level of detail objects should be at, tick frequency, whether to spawn effects, and other such functionality
Each object that is registered must have a corresponding unregister event or else a dangling Object reference will be left resulting in an eventual crash once the Object has been garbage collected.
Each user of the significance manager is expected to call the Update function from the appropriate location in the game code. GameViewportClient::Tick may often serve as a good place to do this.
| Name | USignificanceManager |
| Type | class |
| Header File | /Engine/Plugins/Runtime/SignificanceManager/Source/SignificanceManager/Public/SignificanceManager.h |
| Include Path | #include "SignificanceManager.h" |
Syntax
UCLASS (MinimalAPI, Config=Engine, defaultconfig)
class USignificanceManager : public UObject
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → USignificanceManager
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
USignificanceManager() |
SignificanceManager.h |
Structs
| Name | Remarks |
|---|---|
| FManagedObjectInfo | |
| FManagedObjectInfoFixLayout | Hacky base class to avoid 8 bytes of padding after the vtable. |
| FSequentialPostWorkPair |
Enums
Public
| Name | Remarks |
|---|---|
| EPostSignificanceType |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FManagedObjectPostSignificanceFunction | TFunction< void(FManagedObjectInfo *, float, float, bool)> | SignificanceManager.h | |
| FManagedObjectSignificanceFunction | TFunction< float(FManagedObjectInfo *, const FTransform &)> | SignificanceManager.h | |
| FPostSignificanceFunction | TFunction< void(UObject *, float, float, bool)> | SignificanceManager.h | |
| FSignificanceFunction | TFunction< float(UObject *, const FTransform &)> | SignificanceManager.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ManagedObjects | TMap< TObjectPtr< UObject >, FManagedObjectInfo * > | Reverse lookup map to find the tag for a given object. | SignificanceManager.h | |
| ManagedObjectsByTag | TMap< FName, TArray< FManagedObjectInfo * > > | All objects being managed organized by Tag. | SignificanceManager.h | |
| ObjArray | TArray< FManagedObjectInfo * > | Array of all managed objects that we use for iteration during update. This is kept in sync with the ManagedObjects map. | SignificanceManager.h | |
| ObjArrayCopy | TArray< FManagedObjectInfo * > | We copy ObjArray to this before running update to avoid mutations during the update. To avoid memory allocations, making it a member. | SignificanceManager.h | |
| ObjWithSequentialPostWork | TArray< FSequentialPostWorkPair > | Array of all managed objects requiring sequential work that we use for iteration during update. This is kept in sync with the ManagedObjects map. | SignificanceManager.h | |
| ObjWithSequentialPostWorkCopy | TArray< FSequentialPostWorkPair > | We copy ObjWithSequentialPostWork to this before running update to avoid mutations during the update. To avoid memory allocations, making it a member. | SignificanceManager.h | |
| SignificanceManagerClassName | FSoftClassPath | Game specific significance class to instantiate. | SignificanceManager.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
SignificanceManager.h | ||
const USignificanceManager::FManagedObjectInfo * GetManagedObject
(
const UObject* Object |
Returns the managed object for the passed-in object, if any. Otherwise returns nullptr. | SignificanceManager.h | |
USignificanceManager::FManagedObjectInfo * GetManagedObject
(
UObject* Object |
Returns the managed object for the passed-in object, if any. Otherwise returns nullptr. | SignificanceManager.h | |
const TArray< FManagedObjectInfo * > & GetManagedObjects
(
FName Tag |
Returns objects of specified tag, Tag must be specified or else an empty array will be returned. | SignificanceManager.h | |
void GetManagedObjects
(
TArray< FManagedObjectInfo* >& OutManagedObjects, |
Returns all managed objects regardless of tag. | SignificanceManager.h | |
float GetSignificance
(
const UObject* Object |
Returns the significance value for a given object, returns 0 if object is not managed. | SignificanceManager.h | |
const TArray< FTransform > & GetViewpoints() |
Returns the list of viewpoints currently being represented by the significance manager. | SignificanceManager.h | |
virtual UWorld * GetWorld() |
SignificanceManager.h | ||
bool QuerySignificance
(
const UObject* Object, |
Returns true if the object is being tracked, placing the significance value in OutSignificance (or 0 if object is not managed) | SignificanceManager.h | |
virtual void RegisterObject
(
UObject* Object, |
Overridable function used to register an object as managed by the significance manager. | SignificanceManager.h | |
void UnregisterAll
(
FName Tag |
Unregisters all objects with the specified tag. | SignificanceManager.h | |
virtual void UnregisterObject
(
UObject* Object |
Overridable function used to unregister an object as managed by the significance manager. | SignificanceManager.h | |
virtual void Update
(
TArrayView< const FTransform > Viewpoints |
Overridable function to update the managed objects' significance. | SignificanceManager.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnShowDebugInfo
(
AHUD* HUD, |
Callback function registered with HUD to supply debug info when ShowDebug SignificanceManager has been entered on the console. | SignificanceManager.h | |
void RegisterManagedObject
(
FManagedObjectInfo* ObjectInfo |
Internal function that takes the managed object info and registers it with the significance manager. | SignificanceManager.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void AddReferencedObjects
(
UObject* InThis, |
SignificanceManager.h | ||
static T * Get
(
const UWorld* World |
Templated convenience function to return a significance manager cast to a known type. | SignificanceManager.h | |
static USignificanceManager * Get
(
const UWorld* World |
Returns the significance manager for the specified World. | SignificanceManager.h |