Download

Which is the better slate practice

Hello everyone…

I want to know which is the better slate practice.

I am currently working on my game inventory UI. I want to know which of the following practice is better.

When I want to show my inventory to the player, should I recreate the widget every time the player asks to open the inventory. Something similar to what was done in the shooter game


bool AShooterHUD::ShowScoreboard(bool bEnable, bool bFocus);

Or another method I think of doing is toggling the visibility of the slate when the inventory is requested to be opened.

Something like this


ToolTipUI->SetVisibility(EVisibility::Hidden);

As with any other “load vs. keep in memory” consideration, it depends. The cost of the actual Slate widget creation itself is fairly insignificant compared to the manipulation of its assets.

Does your inventory need lots of texture assets that are too expensive to keep in memory? How fast can you load these when necessary? Depending on these factors and many others, you’ll have to decide on something on the spectrum of “keep everything in memory” vs. “load and recreate everything”.

Even Diablo 3 has struggled with this issue, where displaying certain UI elements (namely, the inventory and the toast notifications) caused a sufficient hitch for players to be really bothered by it.

In our case, we have a fairly comprehensive set of player menus like inventory and mission journals. I’ve settled for holding on to a TSharedPtr of each screen in my UI controller and adding/removing them as needed. Since I am always holding on a reference to the UI screens, this means pretty much everything stays in memory, but that’s not a concern right now as much as opening UI screens quickly and without hitches.

-Camille