Hi all,
So I’m working on an Inventory System and I’ve created the required C++ code to handle all of it and just need some help with a final piece.
I’ve created the UI elements in Blueprint and am having trouble using “Create Widget” with the class set to my C++ class to construct the widget. Any ideas?
Here is my UCLASS parameters for the class I’m trying to use:
UCLASS(Abstract, BlueprintType, Blueprintable, EditInlineNew, DefaultToInstanced)
If I understand correctly, setting the class to ‘Abstract’ means that you can’t instantiate it. Have you tried it without the ‘Abstract’ specifier?
EDIT: Relevant documentation Class Specifiers | Unreal Engine Documentation
3 Likes
Hi,
Thanks for the reply, I’ve just tried that and it still doesn’t show.
Here’s the code for the FLItem class:
class THEFACELESS_API UFLItem : public UObject
{
GENERATED_BODY()
public:
UFLItem();
virtual class UWorld* GetWorld() const { return World; };
UPROPERTY(Transient)
class UWorld* World;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
FText UseActionText;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
class UStaticMesh* PickupMesh;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
class UTexture2D* Thumbnail;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
FText ItemDisplayName;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item", meta = (MultiLine = true))
FText ItemDescription;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item", meta = (ClampMin = 0.0))
float Weight;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
class UFLInventoryComponent* OwningInventory;
UFUNCTION(BlueprintCallable)
virtual void Use(class AFLPlayer* Player) PURE_VIRTUAL(UFLItem, );
UFUNCTION(BlueprintImplementableEvent)
void OnUse(class AFLPlayer* Player);
};
And here’s a link to a screenshot of the blueprint: blueprint — ImgBB
I’m confused. You’re expecting to see this in the CreateWidget class dropdown menu yet your object does not inherit from, at the very least, UWidget?