Unreal 4.20 NavigationSystem changes

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

3 Likes

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”

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.

1 Like

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?

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
		);
}
1 Like

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

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.

Help,
I’m working with UE 4.22 and have just started the course and have just arrived at point 13. Projection on the navmesh. VS does not compile anymore, “UNavigationSystem :: ProjectPointToNavigation is Deprecated”
Where do I have to make changes compiling VS? Please step by step if possible.

Epic provided a python (3.5) script that will output the needed changes
https://epicgames.ent.box.com/s/537wc3x95udak7uqq8wja19fyvbgz7ck
Just put that into your root project directory and run it.

How is that meant? what does the python 3.5 script do? does this have something to do with my problem?

The navigation system was changed in 4.20 running that script should tell you what changes you need to make to update to the new API.

My understanding is, Unreal uses Python 2.7 by default. Can you give me a little more help - where do I put the script exactly - in the project folder at the top, and where do I start the script? do I then open the project or VS?

It’s a separate thing. Install Phyton 3.5 or above on your system. Download that file and put it in the root of your project and then run the script.

Change MAKE_CHANGES_IN_SOURCE_FILES to true in the script if you want it to apply the changes otherwise it’ll do exactly what it says in that comment.

I’ve been doing interim - copy in projectfolder-change MAKE_CHANGES_IN_SOURCE_FILES to true and save - right mousebutton - open with python 3.7 - then open my project - no effect

Do you not get any output with that as false then?

no, no effect.

Also what errors did you get? Not sure if that script adds “NavigationSystem” to the build.cs which you need to do.

Can I find the build.cs when opening via Unreal Engine in VS? Where?
Then copy paste NavSysPathsUpdate.py?

It’s in your Source directory.

Also you haven’t said what errors you got. You should also check the Q&A there’s a couple posts regarding this

image

I think I have to replace the VRCharacter.ccp and the VRCharacter.h in VS with an updated UE.4.22 syntax regarding #include “AI / Navigation / NavigationSystem.h” and bool bOnNavMesh = GetWorld () -> GetNavigationSystem () -> ProjectPointToNavigation (HitResult.Location, NavLocation, TeleportProjectionExtent);
Does anyone already have a UE 4.22 solution for this?

Privacy & Terms