FindPathToActorSynchronously() function not working!

Im having a problem using the following Code:

ACharacter *PlayerPawn = UGameplayStatics::GetPlayerCharacter(this, 0);
UNavigationPath *NavPath = UNavigationSystemV1::FindPathToActorSynchronously(this, GetActorLocation(), PlayerPawn);

The function FindPathToActorSynchronously() is not accepting its third argument as an ACharacter.

Following Headers are included:
#include “STrackerBot.h”
#include “Components/StaticMeshComponent.h”
#include “Kismet/GameplayStatics.h”
#include “NavigationPath.h”
#include “AI/NavigationSystemBase.h”
#include “NavigationSystem.h”

Errors:

2>D:\Unreal Engine\UE_Projects\COOP\Source\COOP\Private\AI\STrackerBot.cpp(36): error C2664: ‘UNavigationPath *UNavigationSystemV1::FindPathToActorSynchronously(UObject *,const FVector &,AActor *,float,AActor *,TSubclassOf)’: cannot convert argument 3 from ‘ACharacter *’ to ‘AActor *’

2>D:\Unreal Engine\UE_Projects\COOP\Source\COOP\Private\AI\STrackerBot.cpp(36): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Hi!
check NavigationSystem module added in ProjectName.Build.cs file
PublicDependencyModuleNames.AddRange(new string[] { “NavigationSystem” });

2 Likes

太感谢了~教程里面老师没有说添加模块~