Navigation
API > API/Plugins > API/Plugins/MetaHumanCrowd
Base class for objects that decide which appearance is used for each spawned crowd entity.
Subclass this (in C++ or Blueprint) and assign your subclass to the AppearanceProviderClass property on the MetaHuman Crowd Visualization trait.
The same provider object handles every spawn/despawn for that class in that world, so it is safe to hold persistent state.
Typical usage:
Override Initialize to inspect the pre-registered MHIs and assemble any extra MHIs you want to make available. Call Subsystem->RegisterInstance(MyAssembledInstance) for each new MHI.
Override AcquireAppearance to pick an appearance for a new entity.
Use Subsystem->TryGetAppearanceHandleForInstance(MHI) to look up the handle for any MHI you already know about (whether pre-registered or registered by this provider).
The world location of the spawn is provided so you can vary appearance by location.
Override OnEntityDespawned to update bookkeeping when an entity is destroyed. This fires on actual entity destruction, not on temporary LOD-driven invisibility.
To grow the pool at runtime, create a new MHI and call RegisterInstance.
To shrink the pool, call UnregisterInstance(Handle). The subsystem refcounts handles, so a handle that is still in use by entities will be physically released only when the last such entity is destroyed.
| Name | UMetaHumanCrowdAppearanceProvider |
| Type | class |
| Header File | /Engine/Plugins/MetaHuman/MetaHumanCrowd/Source/MetaHumanCrowd/Public/Mass/MetaHumanCrowdAppearanceProvider.h |
| Include Path | #include "Mass/MetaHumanCrowdAppearanceProvider.h" |
Syntax
UCLASS (MinimalAPI, Blueprintable, EditInlineNew, Abstract)
class UMetaHumanCrowdAppearanceProvider : public UObject
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UMetaHumanCrowdAppearanceProvider
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMetaHumanCrowdAppearanceHandle AcquireAppearance
(
UMetaHumanMassRepresentationSubsystem* Subsystem, |
Called for each new crowd entity to determine which appearance it should use. | Mass/MetaHumanCrowdAppearanceProvider.h |
|
void Initialize
(
UMetaHumanMassRepresentationSubsystem* Subsystem, |
Called once when this provider is first created for a world. | Mass/MetaHumanCrowdAppearanceProvider.h |
|
void OnEntityDespawned
(
UMetaHumanMassRepresentationSubsystem* Subsystem, |
Called when an entity that was assigned an appearance by this provider is despawned. | Mass/MetaHumanCrowdAppearanceProvider.h |
|
void Shutdown
(
UMetaHumanMassRepresentationSubsystem* Subsystem |
Called when this provider's owning subsystem is being torn down. | Mass/MetaHumanCrowdAppearanceProvider.h |
|
Public Virtual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FMetaHumanCrowdAppearanceHandle AcquireAppearance_Implementation
(
UMetaHumanMassRepresentationSubsystem* Subsystem, |
Mass/MetaHumanCrowdAppearanceProvider.h |
|
|
virtual void Initialize_Implementation
(
UMetaHumanMassRepresentationSubsystem* Subsystem, |
Mass/MetaHumanCrowdAppearanceProvider.h |
|
|
virtual void OnEntityDespawned_Implementation
(
UMetaHumanMassRepresentationSubsystem* Subsystem, |
Mass/MetaHumanCrowdAppearanceProvider.h |
|
|
virtual void Shutdown_Implementation
(
UMetaHumanMassRepresentationSubsystem* Subsystem |
Mass/MetaHumanCrowdAppearanceProvider.h |
|