Is there a best practice for who the OwningObject of newly created object should be?

When creating a UUserWidget, or constructing a UObject , is there a best practice for who the OwningObject should be?

In the source code of UUserWidget::CreateWidget, for example, I can see that it checks if the OwningObject parameter is derived from UWidget, UWidgetTree, APlayerController, UGameInstance, or UWorld.

If adding a child widget to a widget, I would assume you would have the parent widget be the owner?
Is there any benefit to having a higher level object like a UWorld object or APlayerController own the widget?

I have not completed a full game before and want to make sure I don’t do anything that bites me in the butt later!

Thanks for the help!

I recommend AHud to be your UI manager, which comes with AHud::GetOwningPlayerController() to be used as the owner

1 Like