ACharacter::OnRep_IsCrouched
#include "GameFramework/Character.h"
Access: public
Specifiers: UFUNCTIONvirtual
Description
RepNotify called on simulated proxies when bIsCrouched changes. Triggers Crouch or UnCrouch on CharacterMovementComponent to resize the capsule and update the mesh offset.
Caveats & Gotchas
- • Only fires on simulated proxies — the server and autonomous proxy manage crouch state directly through CharacterMovementComponent and do not go through this RepNotify.
- • If you override this without calling Super, the capsule will not be resized on simulated proxies, causing visual and collision desync.
- • Crouch state changes via bIsCrouched replication can arrive slightly out of order relative to position updates, causing a one-frame pop. The built-in network smoothing partially mitigates this.
Signature
ENGINE_API virtual void OnRep_IsCrouched() Return Type
void Example
Override to play a crouch sound on remote clients C++
void AMyCharacter::OnRep_IsCrouched()
{
Super::OnRep_IsCrouched(); // Resizes capsule
if (bIsCrouched)
{
UGameplayStatics::PlaySoundAtLocation(this, CrouchSound, GetActorLocation());
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?