Widget Blueprint will not appear on Viewport (C++ CreateWidget, AddToViewport)

UOnScreenDebugList is a child of UUserWidget, and it has a BP Child class WBP_OnScreenDebugList that I’m trying to add to the viewport thru C++.

It will not appear on the Viewport.

Stepping thru the code with the debugger, it appears to work. It instantiates an On-Screen Debug List using a Widget Blueprint class set through Developer Settings (using a UDeveloperSettings subclass).

However, the blueprint debugger doesn’t detect any instances of the Widget BP, and it doesn’t show up on-screen.

Here’s the widget set in project settings:

	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category="General")
	TSoftObjectPtr<UObject> OnScreenWidgetClass;


I used a UClass because for some reason UUserWidget wouldn’t allow me to select my Widget BP class in the dropdown, it comes out like this:

	UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "General")
	TSoftObjectPtr<class UOnScreenDebugList> OnScreenWidgetClassIfTheWorldWasABetterPlace;

Despite that it’s definitely the parent of my BP class.
image

  1. Why isn’t the Widget appearing on-screen?

  2. Why can’t I use a UOnScreenDebugWidget for my config variable? (Less important, but odd)

TIA

Thanks to Dieter and Zlo on Unreal Slackers for helping me with 2:

	UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "General")
	TSoftClassPtr<UOnScreenDebugList> OnScreenWidget;

Results in something like this:


Question 1 seems to have sorted itself out after I made the above change. ¯_(ツ)_/¯

Here’s the code to spawn the widget:

	const UOnScreenDebugSettings* debugSettings = GetDefault<UOnScreenDebugSettings>();
	DebugOverlay = CreateWidget<UOnScreenDebugList>(GetOuterUGameInstance(), debugSettings->OnScreenWidget.LoadSynchronous());


	if (DebugOverlay != nullptr)
	{
		DebugOverlay->AddToViewport();
	}