bAutoCreateNavigationData
bAutoCreateNavigationData
#Overview
name: bAutoCreateNavigationData
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bAutoCreateNavigationData is to control the automatic creation of navigation data in Unreal Engine 5’s navigation system. This setting variable is used to determine whether the engine should automatically spawn default Navigation Data when none exists and navigation bounds are present.
This setting variable is primarily relied upon by the Navigation System module in Unreal Engine 5. It is used within the UNavigationSystemV1 class, which is a core component of the engine’s navigation system.
The value of this variable is typically set in the project settings or through configuration files. It can also be modified programmatically as seen in the UNavigationSystemModuleConfig::CreateAndConfigureNavigationSystem function.
bAutoCreateNavigationData interacts with other navigation-related variables and functions, such as bSpawnNavDataInNavBoundsLevel and SpawnMissingNavigationData(). It’s often used in conjunction with checks for existing navigation data and the presence of navigation bounds.
Developers must be aware that this variable significantly affects the behavior of the navigation system. When set to true, it can lead to automatic creation of navigation data, which might not always be desirable in all scenarios, especially in performance-sensitive situations or when custom navigation setups are required.
Best practices when using this variable include:
- Carefully consider whether automatic creation of navigation data is necessary for your project.
- Be mindful of performance implications, especially in large or complex environments.
- Ensure that navigation bounds are properly set up when relying on automatic navigation data creation.
- Consider manually managing navigation data creation for more fine-grained control in complex scenarios.
- Be aware of how this setting interacts with other navigation system settings and functions to avoid unexpected behavior.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2803, section: [/Script/NavigationSystem.NavigationSystemV1]
- INI Section:
/Script/NavigationSystem.NavigationSystemV1
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystem.cpp:1210
Scope (from outer to inner):
file
function void UNavigationSystemV1::OnWorldInitDone
Source code excerpt:
RegisterNavigationDataInstances();
if (bAutoCreateNavigationData == true)
{
SpawnMissingNavigationData();
// in case anything spawned has registered
ProcessRegistrationCandidates();
}
else
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystem.cpp:3868
Scope (from outer to inner):
file
function void UNavigationSystemV1::PerformNavigationBoundsUpdate
Source code excerpt:
}
if (NavDataSet.Num() == 0 && bAutoCreateNavigationData == true)
{
SpawnMissingNavigationData();
ProcessRegistrationCandidates();
}
ConditionalPopulateNavOctree();
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystem.cpp:3960
Scope (from outer to inner):
file
function void UNavigationSystemV1::Build
Source code excerpt:
const double BuildStartTime = FPlatformTime::Seconds();
if (bAutoCreateNavigationData == true
#if WITH_EDITOR
|| FNavigationSystem::IsEditorRunMode(OperationMode)
#endif // WITH_EDITOR
)
{
SpawnMissingNavigationData();
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystem.cpp:4542
Scope (from outer to inner):
file
function void UNavigationSystemV1::OnPostLoadMap
Source code excerpt:
// Do this if there's currently no navigation
if ( NavData == nullptr &&
bAutoCreateNavigationData &&
IsThereAnywhereToBuildNavigation() &&
(GetRuntimeGenerationType() != ERuntimeGenerationType::Static) ) // Prevent creating a static default nav instance out of the editor (GetRuntimeGenerationType() is always dynamic in editor).
{
NavData = GetDefaultNavDataInstance(FNavigationSystem::Create);
UE_LOG(LogNavigation, Verbose, TEXT("%s Created DefaultNavDataInstance %s"), ANSI_TO_TCHAR(__FUNCTION__), *GetNameSafe(NavData));
}
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystem.cpp:5790
Scope (from outer to inner):
file
function void UNavigationSystemModuleConfig::UpdateWithNavSysCDO
Source code excerpt:
// between unrelated maps
bCreateOnClient = NavSysCDO.bAllowClientSideNavigation;
bAutoSpawnMissingNavData = NavSysCDO.bAutoCreateNavigationData;
bSpawnNavDataInNavBoundsLevel = NavSysCDO.bSpawnNavDataInNavBoundsLevel;
}
}
UNavigationSystemBase* UNavigationSystemModuleConfig::CreateAndConfigureNavigationSystem(UWorld& World) const
{
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystem.cpp:5811
Scope (from outer to inner):
file
function UNavigationSystemBase* UNavigationSystemModuleConfig::CreateAndConfigureNavigationSystem
Source code excerpt:
if (NavSysInstance)
{
NavSysInstance->bAutoCreateNavigationData = bAutoSpawnMissingNavData;
NavSysInstance->bSpawnNavDataInNavBoundsLevel = bSpawnNavDataInNavBoundsLevel;
NavSysInstance->ConfigureAsStatic(bStrictlyStatic);
}
return NavSysInstance;
}
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Public/NavigationSystem.h:324
Scope (from outer to inner):
file
class class UNavigationSystemV1 : public UNavigationSystemBase
Source code excerpt:
/** Should navigation system spawn default Navigation Data when there's none and there are navigation bounds present? */
UPROPERTY(config, EditAnywhere, Category=NavigationSystem)
uint32 bAutoCreateNavigationData:1;
/** If true will try to spawn the navigation data instance in the sublevel with navigation bounds, if false it will spawn in the persistent level */
UPROPERTY(config, EditAnywhere, Category = NavigationSystem)
uint32 bSpawnNavDataInNavBoundsLevel:1;
/** If false, will not create nav collision when connecting as a client */