Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Private/NavigationSystemModule.cpp
aris theophanidis 813bbf4a58 Fix non-determinism in cooked navmesh assets
When initializing a new world, reset navlinks id counter to make sure each map has its own set of unique ids (else, when cooking map by map, ids may change depending on order of cooking).
[REVIEW] [at]Yoan.StAmant [at]Mieszko.Zielinski
#rb Yoan.StAmant


#ROBOMERGE-SOURCE: CL 11116144 via CL 11116146 via CL 11116148
#ROBOMERGE-BOT: (v640-11091645)

[CL 11116177 by aris theophanidis in Main branch]
2020-01-27 11:32:07 -05:00

62 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "NavigationSystemModule.h"
#include "EngineDefines.h"
#include "AI/NavigationSystemBase.h"
#include "Templates/SubclassOf.h"
#include "Engine/World.h"
#include "NavLinkCustomInterface.h"
#define LOCTEXT_NAMESPACE "NavigationSystem"
DEFINE_LOG_CATEGORY_STATIC(LogNavSysModule, Log, All);
class FNavigationSystemModule : public INavSysModule
{
// Begin IModuleInterface
virtual void StartupModule() override;
virtual void ShutdownModule() override;
//virtual UNavigationSystemBase* CreateNavigationSystemInstance(UWorld& World) override;
// End IModuleInterface
private:
#if WITH_EDITOR
static FDelegateHandle OnPreWorldInitializationHandle;
#endif
};
IMPLEMENT_MODULE(FNavigationSystemModule, NavigationSystem)
#if WITH_EDITOR
FDelegateHandle FNavigationSystemModule::OnPreWorldInitializationHandle;
#endif
void FNavigationSystemModule::StartupModule()
{
// mz@todo bind to all the delegates in FNavigationSystem
#if WITH_EDITOR
OnPreWorldInitializationHandle = FWorldDelegates::OnPreWorldInitialization.AddStatic(&INavLinkCustomInterface::OnPreWorldInitialization);
#endif
}
void FNavigationSystemModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
#if WITH_EDITOR
FWorldDelegates::OnPreWorldInitialization.Remove(OnPreWorldInitializationHandle);
#endif
}
//UNavigationSystemBase* FNavigationSystemModule::CreateNavigationSystemInstance(UWorld& World)
//{
// UE_LOG(LogNavSysModule, Log, TEXT("Creating NavigationSystem for world %s"), *World.GetName());
//
// /*TSubclassOf<UNavigationSystemBase> NavSystemClass = LoadClass<UNavigationSystemBase>(NULL, *UNavigationSystemBase::GetNavigationSystemClassName().ToString(), NULL, LOAD_None, NULL);
// return NewObject<UNavigationSystemBase>(&World, NavSystemClass);*/
// return nullptr;
//}
#undef LOCTEXT_NAMESPACE