[Tutorial] Extend UUserWidget for UMG

Hi,

I’m trying to extend UUserWidget, but can’t cast the widget to my class.

I get

This is what I have:



UCLASS()
class UMyUserWidget : public UUserWidget
{
	GENERATED_UCLASS_BODY()
}

Error shows up with:


BackButton = CreateWidget<UMyUserWidget>(PlayerController, BackButtonClass);
or
BackButton = Cast<UMyUserWidget>(CreateWidget<UUserWidget>(PlayerController, BackButtonClass));

BackButtonClass is of type TSubclassOf<UUserWidget>

Any idea how I can go around this?

Thanks.