Hello, I made a c++ class derived from NavLinkProxy to be abble to automate their placement. (I want the SmartLink Points to be at the same location of SimpleLinks Points)
So i made a new function intended to be called on Blueprint Construction Script.
Problem is the function UNavLinkCustomComponent::SetLinkData cause a compile error in VisualStudio:
Error LNK2019 1 unresolved external symbol "__declspec(dllimport) public: void __cdecl UNavLinkCustomComponent::SetLinkData(struct FVector const &,struct FVector const &,enum ENavLinkDirection::Type)" (__imp_?SetLinkData@UNavLinkCustomComponent@@QEAAXAEBUFVector@@0W4Type@ENavLinkDirection@@@Z) referenced in function "public: void __cdecl AMyNavLinkProxy::ChangePointsLocations(void)" (?ChangePointsLocations@AMyNavLinkProxy@@QEAAXXZ)
Here is the code :
// .h
#pragma once
#include "CoreMinimal.h"
#include "Navigation/NavLinkProxy.h"
#include "MyNavLinkProxy.generated.h"
UCLASS()
class CSURVIVALZ_API AMyNavLinkProxy : public ANavLinkProxy
{
GENERATED_BODY()
AMyNavLinkProxy();
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FVector StartOffset;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FVector EndOffset;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TEnumAsByte<ENavLinkDirection::Type> Dir;
UFUNCTION(BlueprintCallable, Category = "Custom")
void ChangePointsLocations();
};
// .cpp
#include "MyNavLinkProxy.h"
#include "NavLinkCustomComponent.h"
//#include "AI/Navigation/NavLinkDefinition.h"
#include "Engine/Engine.h"
AMyNavLinkProxy::AMyNavLinkProxy()
{
StartOffset = FVector(0);
EndOffset = FVector(0);
Dir = ENavLinkDirection::BothWays;
}
void AMyNavLinkProxy::ChangePointsLocations()
{
// Simple Link
PointLinks[0].Direction = Dir;
PointLinks[0].Left = EndOffset;
PointLinks[0].Right = StartOffset;
// Smart Link : The function that is causing error
GetSmartLinkComp()->SetLinkData(StartOffset, EndOffset, Dir);
}
What is wrong here?
I made some test with the following code in .cpp instead of GetSmartLinkComp() and it compile just fine
UNavLinkCustomComponent* test= nullptr;
if (test)
{
test->SetLinkData(StartOffset, EndOffset, Dir);
}
If this can’t be resolved, should i use another Actor instead of SmartLink?
Any help is greatly appreciated.