Is it more appropriate to create UMG widgets and add to the viewport in Player Controller or Game Instance? I’m curious what the community considers “best practice”.
I usually added my widget to viewport inside the Player Controller since if I ever needed to access something inside it, I can use the “get Player Controller” and a cast.
I’ve watched many videos and have purchased many online courses and I was taught to add the widget through the Player Controller.
PlayerController is for Level related Widgets a good way to go.
If you need something, that needs to persist through Level transitions, you better add that to the GameInstance. This applies for UserWidgets, too.
F.e.: a Widgets with Images, that covers the whole screen → Level Transition → Image Widgets fades out.
In such a case, add the Widget to the GI.
Thanks @ArcReed3215 and @BDC_Patrick for the thoughtful replies.
I am currently using Player Controller to add the widgets to the viewport and will continue to do so. @BDC_Patrick I like the idea of using Game Instance for widgets such as images that are needed for transitions, etc. I don’t yet have a use case for that but may in the future.