ue4.20 NavigationSystem 过时
按照官网的更新说明,更新了NavigationSystem ,但是下面代码还是报错#include "NavigationSystem.h"
UNavigationSystemV1* NavMesh = UNavigationSystemV1::GetCurrent(this);
if (NavMesh) {
const float SearchRadius = 1000.0f;
FNavLocation RandomPt;
const bool bFound = NavMesh->GetRandomReachablePointInRadius(Bot->GetActorLocation(), SearchRadius, RandomPt);
}
报错:
AIEnemy.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl UNavigationSystemV1::GetRandomReachablePointInRadius(struct FVector const &,float,struct FNavLocation &,class ANavigationData *,class TSharedPtr<struct FNavigationQueryFilter const ,1>)const " (__imp_?GetRandomReachablePointInRadius@UNavigationSystemV1@@QEBA_NAEBUFVector@@MAEAUFNavLocation@@PEAVANavigationData@@V?$TSharedPtr@$$CBUFNavigationQueryFilter@@$00@@@Z) referenced in function "public: void __cdecl AAIEnemy::SearchNewPoint(void)" (?SearchNewPoint@AAIEnemy@@QEAAXXZ)
// 4.20版本的需要找到工程的.Build.cs文件(\Source\ProjectName\ProjectName.build.cs)
// 在PublicDependencyModuleNames数组里,添加"NavigationSystem"
// PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "NavigationSystem" });
// C++代码如下:
// #include "NavigationSystem.h"
// UNavigationSystemV1* NavMesh = FNavigationSystem::GetCurrent<UNavigationSystemV1>(this); 6666666666
页:
[1]