Unreal 4.20 NavigationSystem changes

vr2_s01_projecting_onto_the_navmesh

#1

I’m doing the course in 4.20 and ran into the issue of ProjectPointToNavigation() not working. Error says it is not a member of UNavigationSystemBase.

After a few days of searching I found out that most Navigation System-related code has been moved out of the Engine code and into a new Navigation System Module.

So to get the code working I had to add “NavigationSystem” to the core modules in build.cs:

PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “NavigationSystem” });

In .h change: “AI/Navigation/NavigationSystem.h” to “NavigationSystem.h”

in .cpp change:

bool bOnNavMesh = GetWorld()->GetNavigationSystem()->ProjectPointToNavigation(HitResult.Location, NavLocation, TeleportProjectionExtent);

to:

UNavigationSystemV1* NavSystem = FNavigationSystem::GetCurrent(GetWorld());

bool bOnNavMesh = NavSystem->ProjectPointToNavigation(HitResult.Location, NavLocation, TeleportProjectionExtent);

Hope this helps someone


#2

Thanks for this info, although it doesn’t work for me. I updated to the latest version before starting this course, 4.2.3, and I get the errors;

“FNavigationSystem::GetCurrent’: no matching overloaded function found”
“TNavSys *FNavigationSystem::GetCurrent(UWorld *)’: could not deduce template argument for 'TNavSys”


#3

I have it working now. I added

PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “NavigationSystem” });

to the wrong build.cs file. Because this was the navigation system I added it to the navigation build file instead of the main one.