I have a custom path following component
#pragma once
#include "CoreMinimal.h"
#include "Navigation/PathFollowingComponent.h"
#include "MyPathFollowingComponent.generated.h"
UCLASS(Blueprintable, BlueprintType)
class FREEWORLD_API UMyPathFollowingComponent : public UPathFollowingComponent {
GENERATED_UCLASS_BODY()
protected:
virtual bool HasReachedDestination(const FVector& CurrentLocation) const;
}
#include "MyPathFollowingComponent.h"
bool UMyPathFollowingComponent::HasReachedDestination(const FVector& CurrentLocation) const {
// get cylinder at goal location
FVector GoalLocation = *Path->GetPathPointLocation(Path->GetPathPoints().Num() - 1);
return true;
}
Try to compile the code, get error
unresolved external symbol "__declspec(dllimport) public: struct FBasedPosition __cdecl FNavigationPath::GetPathPointLocation(unsigned int)const " (__imp_?GetPathPointLocation@FNavigationPath@@QEBA?AUFBasedPosition@@I@Z) function "protected: virtual bool __cdecl UMyPathFollowingComponent::HasReachedDestination(struct FVector const &)const " (?HasReachedDestination@UMyPathFollowingComponent@@MEBA_NAEBUFVector@@@Z)
Why I get this error? I just copy the source code…
The UE source code
Compile Path->GetPathPoints()
is ok, but Path->GetPathPointLocation(Path->GetPathPoints().Num() - 1)
got error.
And my build.cs modules
PublicDependencyModuleNames.AddRange(new string[] {
"Core", "CoreUObject", "Engine", "InputCore",
"GameplayTags", "ApplicationCore",
"UMG", "Slate", "SlateCore", "AIModule"
});