I want to display image icon from sprite. So I coded like this:
// Lots of custom header here..
#include "Components/Image.h"
#include "Components/TextBlock.h"
#include "Kismet/GameplayStatics.h"
#include "PaperSprite.h"
#include "PaperSpriteBlueprintLibrary.h"
void ABC::DoSomething(int32 ItemId, const UObject* WorldContextObject, UImage* InImage)
{
// Some code here..
auto itemData = gm->GetItemData(ItemId);
if (itemData == nullptr)
return;
FString path = FString(itemData->ItemIconPath);
UPaperSprite* sprite = Cast<UPaperSprite>(StaticLoadObject(UPaperSprite::StaticClass(), NULL, *path));
auto brush = UPaperSpriteBlueprintLibrary::MakeBrushFromSprite(sprite, 0, 0);
InImage->SetBrush(brush);
}
But I got LNK2019 error.
Is that any solution about this problem?