/Engine/Plugins/Experimental/ColorCorrectRegions/Source/ColorCorrectRegions/Public/ColorCorrectRegionsSubsystem.h
This is the only way (that we found) that was handling all region aggregation cases in more or less efficient way. Covered cases: Region added to a level, deleted from level, level loaded, undo, redo, level closed, editor closed: World subsystem keeps track of all Regions in a level via three events OnLevelActorAdded, OnLevelActorDeleted, OnLevelActorListChanged. Actor classes are unaware of when they are added/deleted/undo/redo etc in the level, therefore this is the best place to manage this. Alternative strategies (All tested): World's AddOnActorSpawnedHandler. Flawed. Invoked in some cases we don't need, but does not get called during UNDO/REDOAActor's PostSpawnInitialize, PostActorCreated and OnConstruction are also flawed.AActordoes not have an internal event for when its deleted (EndPlay is the closest we have).
[UCLASS](Programming/UnrealArchitecture/Reference/Classes#classdeclaration)() class UColorCorrectRegionsSubsystem : public [UWorldSubsystem](API\Runtime\Engine\Subsystems\UWorldSubsystem), public [FColorCorrectRegionsEditorUndoClient](API\Plugins\ColorCorrectRegions\FColorCorrectRegionsEditorUndoCl-)
TArray<AColorC...
RegionsDistanceBased
Stores pointers to ColorCorrectRegion Actors that are based on distance from camera.
TArray<AColorC...
RegionsPriorityBased
Stores pointers to ColorCorrectRegion Actors that use priority for sorting.