UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NavigationSystemBase.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "UObject/Object.h"
8#include "Engine/World.h"
9#include "NavigationSystemBase.generated.h"
10
13class AActor;
14class UActorComponent;
15class USceneComponent;
18class AWorldSettings;
19class ULevel;
20class AController;
21class UNavAreaBase;
24
31
32UENUM()
34{
38 SimulationMode UE_DEPRECATED(5.3, "No longer used.") UMETA(Hidden, DisplayName = "DEPRECATED No longer used, to be removed soon"),
39 PIEMode,
42};
43
45{
46 enum Type
47 {
48 Unknown = 1 << 0,
50
55 };
56}
57
59{
60public:
62 : MyWorld(NULL), LockReason((uint8)Reason), bSingleWorld(false), bIsLocked(false)
63 {
64 if (bApplyLock)
65 {
66 LockUpdates();
67 }
68 }
69
71 : MyWorld(InWorld), LockReason((uint8)Reason), bSingleWorld(true), bIsLocked(false)
72 {
73 if (bApplyLock)
74 {
75 LockUpdates();
76 }
77 }
78
80 {
81 UnlockUpdates();
82 }
83
84private:
85 UWorld* MyWorld;
86 uint8 LockReason;
87 uint8 bSingleWorld : 1;
88 uint8 bIsLocked : 1;
89
90 ENGINE_API void LockUpdates();
91 ENGINE_API void UnlockUpdates();
92};
93
94namespace FNavigationSystem
95{
107 ENGINE_API void AddNavigationSystemToWorld(UWorld& WorldOwner, const FNavigationSystemRunMode RunMode = FNavigationSystemRunMode::InvalidMode, UNavigationSystemConfig* NavigationSystemConfig = nullptr, const bool bInitializeForWorld = true, const bool bOverridePreviousNavSys = false);
108
110 ENGINE_API void DiscardNavigationDataChunks(UWorld& InWorld);
111
112 ENGINE_API bool IsEditorRunMode(const FNavigationSystemRunMode Mode);
113
114 template<typename TNavSys>
115 inline TNavSys* GetCurrent(UWorld* World)
116 {
117 return World ? Cast<TNavSys>(World->GetNavigationSystem()) : (TNavSys*)nullptr;
118 }
119
120 template<typename TNavSys>
121 inline const TNavSys* GetCurrent(const UWorld* World)
122 {
123 return World ? Cast<TNavSys>(World->GetNavigationSystem()) : (const TNavSys*)nullptr;
124 }
125
126 ENGINE_API UWorld* GetWorldFromContextObject(UObject* WorldContextObject);
127
128 template<typename TNavSys>
129 TNavSys* GetCurrent(UObject* WorldContextObject)
130 {
131 UWorld* World = GetWorldFromContextObject(WorldContextObject);
133 }
134
135 ENGINE_API void UpdateActorData(AActor& Actor);
136 ENGINE_API void UpdateComponentData(UActorComponent& Comp);
137 ENGINE_API void UpdateActorAndComponentData(AActor& Actor, bool bUpdateAttachedActors = true);
138 ENGINE_API void UpdateComponentDataAfterMove(USceneComponent& Comp);
139 //ENGINE_API bool HasComponentData(UActorComponent& Comp);
140 ENGINE_API void OnActorBoundsChanged(AActor& Actor);
141 ENGINE_API void OnPostEditActorMove(AActor& Actor);
142
143 UE_DEPRECATED(5.4, "Use OnObjectBoundsChanged taking UObject and list of dirty areas as parameters instead.")
144 ENGINE_API void OnComponentBoundsChanged(UActorComponent& Comp, const FBox& NewBounds, const FBox& DirtyArea);
145 ENGINE_API void OnComponentTransformChanged(USceneComponent& Comp);
146
147 ENGINE_API void OnActorRegistered(AActor& Actor);
148 ENGINE_API void OnActorUnregistered(AActor& Actor);
149
150 ENGINE_API void OnComponentRegistered(UActorComponent& Comp);
151 ENGINE_API void OnComponentUnregistered(UActorComponent& Comp);
152
153 ENGINE_API void RegisterComponent(UActorComponent& Comp);
154 ENGINE_API void UnregisterComponent(UActorComponent& Comp);
155
156 ENGINE_API void RegisterNavRelevantObject(UObject& Object);
157 ENGINE_API void UpdateNavRelevantObject(UObject& Object);
158 ENGINE_API void UnregisterNavRelevantObject(UObject& Object);
159 ENGINE_API void OnObjectBoundsChanged(UObject& Object, const FBox& NewBounds, TConstArrayView<FBox> DirtyAreas);
160
161 ENGINE_API bool SupportsDynamicChanges(UWorld* World);
162 ENGINE_API FNavigationElementHandle AddNavigationElement(UWorld* World, FNavigationElement&& Element);
163 ENGINE_API void UpdateNavigationElement(UWorld* World, FNavigationElementHandle ElementHandle, FNavigationElement&& Element);
164 ENGINE_API void RemoveNavigationElement(UWorld* World, FNavigationElementHandle ElementHandle);
165 ENGINE_API void OnNavigationElementBoundsChanged(UWorld* World, FNavigationElementHandle ElementHandle, const FBox& NewBounds, TConstArrayView<FBox> DirtyAreas);
166
167 ENGINE_API void RemoveActorData(AActor& Actor);
168
169 ENGINE_API bool HasComponentData(UActorComponent& Comp);
170
171 ENGINE_API const FNavDataConfig& GetDefaultSupportedAgent();
172 ENGINE_API const FNavDataConfig& GetBiggestSupportedAgent(const UWorld* World);
173 ENGINE_API double GetWorldPartitionNavigationDataBuilderOverlap(const UWorld& World);
174
175 ENGINE_API TSubclassOf<UNavAreaBase> GetDefaultWalkableArea();
176 ENGINE_API TSubclassOf<UNavAreaBase> GetDefaultObstacleArea();
177
180 ENGINE_API const FTransform& GetCoordTransform(const ENavigationCoordSystem::Type FromCoordType, const ENavigationCoordSystem::Type ToCoordType);
181
182 ENGINE_API bool WantsComponentChangeNotifies();
183
184 ENGINE_API INavigationDataInterface* GetNavDataForActor(const AActor& Actor);
185 ENGINE_API TSubclassOf<AActor> GetDefaultNavDataClass();
186
187 ENGINE_API void VerifyNavigationRenderingComponents(UWorld& World, const bool bShow);
189
190#if WITH_EDITOR
191 ENGINE_API void OnPIEStart(UWorld& World);
192 ENGINE_API void OnPIEEnd(UWorld& World);
195#endif // WITH_EDITOR
196
197 enum class ECleanupMode : uint8
198 {
199 CleanupWithWorld,
200 CleanupUnsafe,
201 };
202
203 // pathfollowing
204 ENGINE_API bool IsFollowingAPath(const AController& Controller);
205 ENGINE_API void StopMovement(const AController& Controller);
206 ENGINE_API IPathFollowingAgentInterface* FindPathFollowingAgentForActor(const AActor& Actor);
207
212 DECLARE_DELEGATE_FourParams(FUpdateNavigationElementBoundsSignature, UWorld* /*World*/, FNavigationElementHandle /*ElementHandle*/, const FBox& /*NewBounds*/, TConstArrayView<FBox> /*DirtyAreas*/)
213
215 DECLARE_DELEGATE_ThreeParams(FObjectBoundsChangedSignature, UObject& /*Object*/, const FBox& /*NewBounds*/, TConstArrayView<FBox> /*DirtyAreas*/)
222 DECLARE_DELEGATE_TwoParams(FNavigationAutoUpdateEnableSignature, const bool /*bNewEnable*/, UNavigationSystemBase* /*InNavigationSystem*/);
230 DECLARE_DELEGATE_TwoParams(FActorBooleBasedSignature, AActor& /*Actor*/, bool /*bUpdateAttachedActors*/);
234 DECLARE_DELEGATE_TwoParams(FWorldBoolBasedSignature, UWorld& /*World*/, const bool /*bShow*/);
237
238 UE_DEPRECATED(5.4, "Use FObjectBoundsChangedSignature delegate taking UObject and list of dirty areas as parameters instead.")
239 DECLARE_DELEGATE_ThreeParams(FComponentBoundsChangeSignature, UActorComponent& /*Comp*/, const FBox& /*NewBounds*/, const FBox& /*DirtyArea*/)
240}
241
242
243UCLASS(Abstract, config = Engine, defaultconfig, Transient, MinimalAPI)
245{
247
248public:
250
251 virtual void Tick(float DeltaSeconds) PURE_VIRTUAL(UNavigationSystemBase::Tick, );
252 virtual void CleanUp(const FNavigationSystem::ECleanupMode Mode) PURE_VIRTUAL(UNavigationSystemBase::CleanUp, );
253 virtual void Configure(const UNavigationSystemConfig& Config) PURE_VIRTUAL(UNavigationSystemBase::Configure, );
255 virtual void AppendConfig(const UNavigationSystemConfig& NewConfig) PURE_VIRTUAL(UNavigationSystemBase::AppendConfig, );
256
260 virtual void OnInitializeActors() {}
261
262 virtual bool IsNavigationBuilt(const AWorldSettings* Settings) const { return false; }
263
264 virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) PURE_VIRTUAL(UNavigationSystemBase::ApplyWorldOffset, );
265
266 virtual void InitializeForWorld(UWorld& World, FNavigationSystemRunMode Mode) PURE_VIRTUAL(UNavigationSystemBase::InitializeForWorld, );
267
273 virtual INavigationDataInterface* GetMainNavData() const { return nullptr; }
274
275 virtual void SetBuildBounds(const FBox& Bounds) PURE_VIRTUAL(UNavigationSystemBase::SetBuildBounds, );
276
277 virtual FBox GetNavigableWorldBounds() const PURE_VIRTUAL(UNavigationSystemBase::GetNavigableWorldBounds, return FBox(ForceInit););
278
279 virtual bool ContainsNavData(const FBox& Bounds) const PURE_VIRTUAL(UNavigationSystemBase::ContainsNavData, return false;);
280 virtual FBox ComputeNavDataBounds() const PURE_VIRTUAL(UNavigationSystemBase::GetNavigableWorldBounds, return FBox(ForceInit););
281
282 virtual void AddNavigationDataChunk(class ANavigationDataChunkActor& DataChunkActor) {}
285
286 virtual bool IsWorldInitDone() const PURE_VIRTUAL(UNavigationSystemBase::IsWorldInitDone, return false;);
287
293 virtual bool ShouldCreateNavigationSystemInstance(const UWorld* World) const PURE_VIRTUAL(UNavigationSystemBase::ShouldCreateNavigationSystemInstance, return true;);
294
295 static ENGINE_API FNavigationSystem::FOnNavigationInitSignature& OnNavigationInitStartStaticDelegate();
296 static ENGINE_API FNavigationSystem::FOnNavigationInitSignature& OnNavigationInitDoneStaticDelegate();
297 static ENGINE_API FNavigationSystem::FOnNavAreaGenericEvent& OnNavAreaRegisteredDelegate();
298 static ENGINE_API FNavigationSystem::FOnNavAreaGenericEvent& OnNavAreaUnregisteredDelegate();
299
305 static ENGINE_API void SetCoordTransform(const ENavigationCoordSystem::Type FromCoordType, const ENavigationCoordSystem::Type ToCoordType, const FTransform& Transform, bool bAddInverse = true);
306 static ENGINE_API void SetWantsComponentChangeNotifies(const bool bEnable);
307 static ENGINE_API void SetDefaultWalkableArea(TSubclassOf<UNavAreaBase> InAreaClass);
308 static ENGINE_API void SetDefaultObstacleArea(TSubclassOf<UNavAreaBase> InAreaClass);
309
310 static ENGINE_API void ResetEventDelegates();
311
312 static ENGINE_API FNavigationSystem::FSupportsDynamicChangesSignature& GetSupportsDynamicChangesDelegate();
313 static ENGINE_API FNavigationSystem::FAddNavigationElementSignature& GetAddNavigationElementDelegate();
314 static ENGINE_API FNavigationSystem::FUpdateNavigationElementSignature& GetUpdateNavigationElementDelegate();
315 static ENGINE_API FNavigationSystem::FRemoveNavigationElementSignature& GetRemoveNavigationElementDelegate();
316 static ENGINE_API FNavigationSystem::FUpdateNavigationElementBoundsSignature& GetUpdateNavigationElementBoundsDelegate();
317
318 static ENGINE_API FNavigationSystem::FObjectBasedSignature& RegisterNavRelevantObjectDelegate();
319 static ENGINE_API FNavigationSystem::FObjectBasedSignature& UpdateNavRelevantObjectDelegate();
320 static ENGINE_API FNavigationSystem::FObjectBasedSignature& UnregisterNavRelevantObjectDelegate();
321 static ENGINE_API FNavigationSystem::FObjectBoundsChangedSignature& OnObjectBoundsChangedDelegate();
322
323 static ENGINE_API FNavigationSystem::FActorBasedSignature& UpdateActorDataDelegate();
325 static ENGINE_API FNavigationSystem::FSceneComponentBasedSignature& UpdateComponentDataAfterMoveDelegate();
326 static ENGINE_API FNavigationSystem::FActorBasedSignature& OnActorBoundsChangedDelegate();
327 static ENGINE_API FNavigationSystem::FActorBasedSignature& OnPostEditActorMoveDelegate();
328 static ENGINE_API FNavigationSystem::FSceneComponentBasedSignature& OnComponentTransformChangedDelegate();
329 static ENGINE_API FNavigationSystem::FActorBasedSignature& OnActorRegisteredDelegate();
330 static ENGINE_API FNavigationSystem::FActorBasedSignature& OnActorUnregisteredDelegate();
331 static ENGINE_API FNavigationSystem::FActorComponentBasedSignature& OnComponentRegisteredDelegate();
332 static ENGINE_API FNavigationSystem::FActorComponentBasedSignature& OnComponentUnregisteredDelegate();
335 static ENGINE_API FNavigationSystem::FActorBasedSignature& RemoveActorDataDelegate();
337 static ENGINE_API FNavigationSystem::FNavDataConfigBasedSignature& GetDefaultSupportedAgentDelegate();
338 static ENGINE_API FNavigationSystem::FNavDataConfigAndWorldSignature& GetBiggestSupportedAgentDelegate();
339 static ENGINE_API FNavigationSystem::FActorBooleBasedSignature& UpdateActorAndComponentDataDelegate();
340 static ENGINE_API FNavigationSystem::FNavDataForActorSignature& GetNavDataForActorDelegate();
341 static ENGINE_API FNavigationSystem::FNavDataClassFetchSignature& GetDefaultNavDataClassDelegate();
342 static ENGINE_API FNavigationSystem::FWorldBoolBasedSignature& VerifyNavigationRenderingComponentsDelegate();
344
346 static ENGINE_API FNavigationSystem::FComponentBoundsChangeSignature& OnComponentBoundsChangedDelegate();
348#if WITH_EDITOR
349 static ENGINE_API FNavigationSystem::FWorldBasedSignature& OnPIEStartDelegate();
350 static ENGINE_API FNavigationSystem::FWorldBasedSignature& OnPIEEndDelegate();
351 static ENGINE_API FNavigationSystem::FLevelBasedSignature& UpdateLevelCollisionDelegate();
352 static ENGINE_API FNavigationSystem::FNavigationAutoUpdateEnableSignature& SetNavigationAutoUpdateEnableDelegate();
353 static ENGINE_API FNavigationSystem::FWorldByteBasedSignature& AddNavigationUpdateLockDelegate();
354 static ENGINE_API FNavigationSystem::FWorldByteBasedSignature& RemoveNavigationUpdateLockDelegate();
355 static ENGINE_API FNavigationSystem::FDoubleWorldBasedSignature& GetWorldPartitionNavigationDataBuilderOverlapDelegate();
356#endif // WITH_EDITOR
357};
358
359
361{
362protected:
363 static ENGINE_API FNavigationSystem::FControllerBasedSignature& StopMovementDelegate();
364 static ENGINE_API FNavigationSystem::FBoolControllerBasedSignature& IsFollowingAPathDelegate();
365};
#define NULL
Definition oodle2base.h:134
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
@ ForceInit
Definition CoreMiscDefines.h:155
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:58
#define DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
#define DECLARE_DELEGATE_RetVal(ReturnValueType, DelegateName)
Definition DelegateCombinations.h:41
#define DECLARE_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:57
#define DECLARE_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:48
#define DECLARE_DELEGATE_RetVal_TwoParams(ReturnValueType, DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:63
#define DECLARE_DELEGATE_ThreeParams(DelegateName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:66
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
#define DECLARE_DELEGATE_FourParams(DelegateName, Param1Type, Param2Type, Param3Type, Param4Type)
Definition DelegateCombinations.h:75
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
return true
Definition ExternalRpcRegistry.cpp:601
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
FNavigationSystemRunMode
Definition NavigationSystemBase.h:34
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UMETA(...)
Definition ObjectMacros.h:747
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Actor.h:257
Definition Controller.h:41
Definition NavigationDataChunkActor.h:14
Definition Engine.Build.cs:7
Definition NavigationSystemBase.h:59
~FNavigationLockContext()
Definition NavigationSystemBase.h:79
FNavigationLockContext(ENavigationLockReason::Type Reason=ENavigationLockReason::Unknown, bool bApplyLock=true)
Definition NavigationSystemBase.h:61
FNavigationLockContext(UWorld *InWorld, ENavigationLockReason::Type Reason=ENavigationLockReason::Unknown, bool bApplyLock=true)
Definition NavigationSystemBase.h:70
Definition UnrealType.h:3087
Definition NavigationDataInterface.h:26
Definition PathFollowingAgentInterface.h:21
Definition NavigationSystemBase.h:361
Definition SubclassOf.h:30
Definition ActorComponent.h:152
Definition Class.h:3793
Definition Level.h:423
Definition NavAreaBase.h:14
Definition NavigationSystemBase.h:245
virtual bool IsWorldInitDone() const PURE_VIRTUAL(UNavigationSystemBase
Definition NavigationSystemBase.h:286
virtual void virtual Tick(float DeltaSeconds) PURE_VIRTUAL(UNavigationSystemBase void virtual CleanUp(const FNavigationSystem::ECleanupMode Mode) PURE_VIRTUAL(UNavigationSystemBase void virtual Configure(const UNavigationSystemConfig &Config) PURE_VIRTUAL(UNavigationSystemBase void virtual AppendConfig(const UNavigationSystemConfig &NewConfig) PURE_VIRTUAL(UNavigationSystemBase void OnInitializeActors()
Definition NavigationSystemBase.h:260
virtual bool IsNavigationBuilt(const AWorldSettings *Settings) const
Definition NavigationSystemBase.h:262
virtual void FillNavigationDataChunkActor(const FBox &QueryBounds, class ANavigationDataChunkActor &DataChunkActor, FBox &OutTilesBounds)
Definition NavigationSystemBase.h:284
virtual void virtual ApplyWorldOffset(const FVector &InOffset, bool bWorldShift) PURE_VIRTUAL(UNavigationSystemBase void virtual InitializeForWorld(UWorld &World, FNavigationSystemRunMode Mode) PURE_VIRTUAL(UNavigationSystemBase INavigationDataInterface * GetMainNavData() const
Definition NavigationSystemBase.h:273
virtual ~UNavigationSystemBase()
Definition NavigationSystemBase.h:249
virtual void RemoveNavigationDataChunk(class ANavigationDataChunkActor &DataChunkActor)
Definition NavigationSystemBase.h:283
virtual void virtual SetBuildBounds(const FBox &Bounds) PURE_VIRTUAL(UNavigationSystemBase FBox GetNavigableWorldBounds() const PURE_VIRTUAL(UNavigationSystemBase
Definition NavigationSystemBase.h:277
Definition NavigationSystemConfig.h:15
Definition Object.h:95
Definition World.h:918
Definition NavigationModifier.h:67
Definition NavigationSystemBase.h:45
Type
Definition NavigationSystemBase.h:47
@ AllowUnregister
Definition NavigationSystemBase.h:49
@ ContinuousEditorMove
Definition NavigationSystemBase.h:53
@ MaterialUpdate
Definition NavigationSystemBase.h:51
@ SpawnOnDragEnter
Definition NavigationSystemBase.h:54
@ Unknown
Definition NavigationSystemBase.h:48
@ LightingUpdate
Definition NavigationSystemBase.h:52
Definition NavigationTypes.h:38
@ false
Definition radaudio_common.h:23
Definition NavigationTypes.h:453
Definition NavigationTypes.h:525
Definition NavigationElement.h:36
Definition NavigationElement.h:94