UActorComponent::SetCanEverAffectNavigation
#include "Components/ActorComponent.h"
Access: public
Specifiers: ENGINE_API
Description
Sets the `bCanEverAffectNavigation` flag and updates the navigation octree if needed. Use this instead of setting the flag directly so that the navigation system stays consistent.
Caveats & Gotchas
- • For best performance, if setting to true first set all other navigation-relevant properties (mesh, transform, etc.) and then call this; if setting to false, call this first before changing other properties. This ordering minimises redundant nav octree updates.
- • This function only triggers a nav octree update if the component is already registered. Calling it during construction before registration has no immediate nav cost, but the flag will be respected once the component registers.
Signature
ENGINE_API void SetCanEverAffectNavigation(bool bRelevant) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bRelevant | bool | Whether this component should be considered by the navigation system. | — |
Return Type
void Example
Opt a component into navigation at runtime C++
// Order matters: set other properties first, then enable nav relevance
MyMeshComponent->SetStaticMesh(NavMesh);
MyMeshComponent->SetCanEverAffectNavigation(true); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?