Here I’m trying to *override *the *function NatuiveOnMouseButtonDown *but i always get the same error, *unresolved externals *when using FReply.
Unreal Engine version: 4.22
Visual Studio version: 2019
**.h file:
**
#pragma once
#include "CoreMinimal.h"
#include "InventorySystemComponent.h"
#include "Blueprint/UserWidget.h"
#include "InventorySlot.generated.h"
UCLASS()
class INVENTORYSYSTEM_API UInventorySlot : public UUserWidget
{
GENERATED_BODY()
public:
UInventorySlot(const FObjectInitializer& ObjectInitializer);
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn))
FS_Item Item;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn))
FKey DetectDragKey;
public:
void NativeOnDragDetected(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent, UDragDropOperation*& OutOperation) override;
UFUNCTION(BlueprintCallable)
void UpdateSlot(UPARAM(DisplayName = "Item") FS_Item ItemParam);
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void OnSlotUpdated();
protected:
virtual FReply NativeOnMouseButtonDown(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent) override;
};
.cpp file:
#include "InventorySlot.h"
#include "InventorySystemDragDropOperation.h"
#include "WidgetBlueprintLibrary.h"
UInventorySlot::UInventorySlot(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
Item = FS_Item();
DetectDragKey = EKeys::LeftMouseButton;
}
FReply UInventorySlot::NativeOnMouseButtonDown(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent)
{
FReply Local_Reply = Super::OnMouseButtonDown(InGeometry, InMouseEvent).NativeReply;
return UWidgetBlueprintLibrary::DetectDragIfPressed(InMouseEvent, this, DetectDragKey).NativeReply;
}
void UInventorySlot::NativeOnDragDetected(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent, UDragDropOperation*& OutOperation)
{
Super::OnDragDetected(InGeometry, InMouseEvent, OutOperation);
OutOperation = Cast<UInventorySystemDragDropOperation>(UWidgetBlueprintLibrary::CreateDragDropOperation(UInventorySystemDragDropOperation::StaticClass()));
OutOperation->DefaultDragVisual = this;
OutOperation->Pivot = EDragPivot::MouseDown;
}
void UInventorySlot::UpdateSlot(FS_Item ItemParam)
{
Item = ItemParam;
OnSlotUpdated();
}
void UInventorySlot::OnSlotUpdated_Implementation(){}
Error Log:
1>InventorySlot.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl FReply::~FReply(void)” (_imp??1FReply@@QEAA@XZ) referenced in function “public: __cdecl FEventReply::~FEventReply(void)” (??1FEventReply@@QEAA@XZ)
1>InventorySlot.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl FReply::FReply(class FReply &&)” (_imp??0FReply@@QEAA@$$QEAV0@@Z) referenced in function “protected: virtual class FReply __cdecl UInventorySlot::NativeOnMouseButtonDown(struct FGeometry const &,struct FPointerEvent const &)” (?NativeOnMouseButtonDown@UInventorySlot@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
1>InventorySlot.cpp.obj : error LNK2001: unresolved external symbol “public: __cdecl FReply::~FReply(void)” (??1FReply@@QEAA@XZ)
1>C:\Users\Fernando Nunes\Documents\Unreal Projects\InventorySystem\Binaries\Win64\UE4Editor-InventorySystem.dll : fatal error LNK1120: 3 unresolved externals