solairewrite 发表于 2018-10-10 00:49:31

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)


solairewrite 发表于 2018-10-10 21:59:35

        // 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);

HHL 发表于 2018-10-11 19:39:33

6666666666
页: [1]
查看完整版本: ue4.20 NavigationSystem 过时