Unreal 4.20 NavigationSystem changes

11_ae_vr2
virtual-reality-vr
architecture-explorer

#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.


#4

I still get the errors

Severity Code Description Project File Line Suppression State
Error C2672 ‘FNavigationSystem::GetCurrent’: no matching overloaded function found ArchitectureExplorer D:\Unreal Projects\Udemy_VR\ArchitectureExplorer\Source\ArchitectureExplorer\VRCharacter.cpp 58

Severity Code Description Project File Line Suppression State
Error C2783 ‘TNavSys *FNavigationSystem::GetCurrent(UWorld *)’: could not deduce template argument for ‘TNavSys’ ArchitectureExplorer D:\Unreal Projects\Udemy_VR\ArchitectureExplorer\Source\ArchitectureExplorer\VRCharacter.cpp 58

After making these changes. Any further ideas?


#5

Hi, besides adding the module I got it work by casting to UNavigationSystemV1. Hope it helps.

UNavigationSystemV1* NavSystem = Cast<UNavigationSystemV1>(GetWorld()->GetNavigationSystem());
bool bHitNav = false;
if (NavSystem != nullptr) {
	bHitNav = NavSystem->ProjectPointToNavigation
		(
			OutHit.Location,
			OutLocation,
			Extent
		);
}

#6

I am getting “unresolved external symbol” errors when trying the UNavigationSystemV1 approach. I included NavigationSystem.h. I am using UE4.21.2

Error LNK2019 unresolved external symbol “__declspec(dllimport) private: static class UClass * __cdecl UNavigationSystemV1::GetPrivateStaticClass(void)” (_imp?GetPrivateStaticClass@UNavigationSystemV1@@CAPEAVUClass@@XZ) referenced in function “private: void __cdecl AVRCharacter::UpdateDestinationMarker(void)” (?UpdateDestinationMarker@AVRCharacter@@AEAAXXZ) ArchitectureExplorer E:\UE4 Projects\ArchitectureExplorer\Intermediate\ProjectFiles\VRCharacter.cpp.obj 1


#7

I got it working.

DONT copy and paste…
PublicDependencyModuleNames.AddRange(new string { “Core”, “CoreUObject”, “Engine”, “InputCore”, “NavigationSystem” });

From the post above. Just type it in. The quotation marks are not the same as the standard quotation marks.