AActor::GetReplayPriority
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_API
Description
Returns the priority for replicating this actor into a replay recording. Higher values are recorded more frequently. Overrides GetNetPriority specifically for replay scenarios, allowing actors to behave differently in replays versus live sessions.
Caveats & Gotchas
- • This function is only consulted during replay recording, not during live multiplayer sessions. For live replication priority, override GetNetPriority instead.
- • The default implementation delegates to GetNetPriority, so you only need to override this if replay and live replication priorities should differ — for example, de-prioritizing background NPCs in replays to reduce file size.
- • Returning a very high value for many actors simultaneously can cause replay files to grow very large, as the replay system tries to record them at maximum fidelity.
Signature
ENGINE_API virtual float GetReplayPriority(const FVector& ViewPos, const FVector& ViewDir, class AActor* Viewer, AActor* ViewTarget, UActorChannel* const InChannel, float Time); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ViewPos | const FVector& | Position of the viewer in world space. | — |
| ViewDir | const FVector& | View direction vector of the viewer. | — |
| Viewer | class AActor* | Net object owned by the client for whom priority is being determined (typically a PlayerController). | — |
| ViewTarget | AActor* | The actor currently being viewed or controlled by Viewer. | — |
| InChannel | UActorChannel* const | The actor channel on which this actor is being replicated. | — |
| Time | float | Time in seconds since this actor was last replicated. | — |
Return Type
float Example
Boosting replay priority for the player character C++
float AMyCharacter::GetReplayPriority(const FVector& ViewPos, const FVector& ViewDir,
AActor* Viewer, AActor* ViewTarget, UActorChannel* const InChannel, float Time)
{
// Always record the local player pawn at maximum priority in replays
if (IsLocallyControlled())
{
return 10.0f;
}
return Super::GetReplayPriority(ViewPos, ViewDir, Viewer, ViewTarget, InChannel, Time);
} See Also
Tags
Version History
Introduced in: 4.13
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?