UCharacterMovementComponent::HasPredictionData_Server
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualoverride
Description
Returns true if server-side movement prediction data has already been allocated for this component.
Caveats & Gotchas
- • Checking this before calling GetPredictionData_Server_Character() lets you avoid triggering the lazy allocation when you only want to know whether prediction has been set up yet.
- • Returns false on clients, since server prediction data is never allocated there under normal conditions.
- • SendClientAdjustment() itself guards on this — if it's false, there's no bForceClientUpdate flag or last-acknowledged-move data to check, so no correction can be sent.
Signature
virtual bool HasPredictionData_Server() const override Return Type
bool Example
Guarding server-only correction logic C++
UCharacterMovementComponent* MoveComp = GetCharacterMovement();
if (HasAuthority() && MoveComp->HasPredictionData_Server())
{
FNetworkPredictionData_Server_Character* ServerData = MoveComp->GetPredictionData_Server_Character();
// Safe to inspect ServerData here.
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?