UCharacterMovementComponent::PackNetworkMovementMode
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualENGINE_APIconst
Description
Packs the current MovementMode, CustomMovementMode, and GroundMovementMode into a single byte for efficient replication over the network.
Caveats & Gotchas
- • The packing scheme is internal and version-dependent — always unpack with UnpackNetworkMovementMode() from the same engine version rather than assuming a stable bit layout.
- • Called automatically as part of the client-to-server move RPCs; overriding it requires a matching override of UnpackNetworkMovementMode() and ApplyNetworkMovementMode() or corrections will decode incorrectly.
- • Custom movement modes are packed into the same byte as the base mode, so projects with many custom modes should verify the packed value still round-trips correctly through UnpackNetworkMovementMode().
Signature
virtual uint8 PackNetworkMovementMode() const Return Type
uint8 Example
Round-tripping a packed mode C++
UCharacterMovementComponent* Movement = GetCharacterMovement();
const uint8 Packed = Movement->PackNetworkMovementMode();
TEnumAsByte<EMovementMode> OutMode, OutGroundMode;
uint8 OutCustomMode;
Movement->UnpackNetworkMovementMode(Packed, OutMode, OutCustomMode, OutGroundMode); See Also
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?