Dear experts,
I made a class that extends UUserWidget
class TEST_API UInventorySlot : public UUserWidget
{
GENERATED_BODY()
public:
//constructor
UInventorySlot(const FObjectInitializer& ObjectInitializer);
}
I had trouble getting the Constructor right, this is what it looks in the .cpp file:
UInventorySlot::UInventorySlot(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
....
}
It is compiling and working but my question is: why do I need this “FObjectInitializer”? I can see in “UserWidget.h” it is using the same syntax:
UUserWidget(const FObjectInitializer& ObjectInitializer);
Why does it not just have a “normal” constructor?
Thank you, Peter