UCharacterMovementComponent::HasValidData
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualconst
Description
Returns true if the component has both a valid UpdatedComponent and a valid CharacterOwner. This is the standard guard used at the top of most movement functions.
Caveats & Gotchas
- • In non-shipping builds with ENABLE_NAN_DIAGNOSTIC, it also checks Velocity and the updated component's transform/rotation for NaN/Inf and force-zeroes Velocity if corruption is found — so it isn't a pure read-only check in those configurations.
- • Custom movement mode overrides (e.g. inside PhysCustom) should call this first and bail out early if it returns false, matching the pattern used throughout the engine's own Phys*() functions.
Signature
virtual bool HasValidData() const Return Type
bool Example
Guarding a custom physics mode C++
void UMyCharacterMovementComponent::PhysCustom(float deltaTime, int32 Iterations)
{
if (!HasValidData())
{
return;
}
// custom movement physics
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?