UCharacterMovementComponent::HasPredictionData_Client
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualoverride
Description
Returns true if client-side movement prediction data has already been allocated for this component.
Caveats & Gotchas
- • Checking this before calling GetPredictionData_Client_Character() lets you avoid triggering the lazy allocation when you only want to know whether prediction has been set up yet.
- • Returns false on a dedicated server, since client prediction data is never allocated there under normal conditions.
- • This reflects whether the data has been allocated at least once, not whether the character is currently locally controlled.
Signature
virtual bool HasPredictionData_Client() const override Return Type
bool Example
Guarding access without forcing allocation C++
UCharacterMovementComponent* MoveComp = GetCharacterMovement();
if (MoveComp->HasPredictionData_Client())
{
FNetworkPredictionData_Client_Character* ClientData = MoveComp->GetPredictionData_Client_Character();
// Safe to inspect ClientData here.
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?