I’ve setup split screen and everything has been sorted out except the UI. We use UMG widgets for most the UI, although a lot of the game is implemented in C++ and some of the UMG functionality is in C++ as well.
We have this problem where UI doesn’t scale to match the size of the split screen viewports. Some pictures will show it better.
As you can see the UI is on the correct viewport but hasn’t changed in size. We need some way to apply DPI scaling, or something of the like to individual viewports. Is this possible? Does anyone else have experience solving this?
When adding your widget did you call AddToViewport? There’s another two functions with the AddTo prefix; one is AddToPlayer I think. Maybe that will work?
The scale of the UI based on the DPI Scale curve is based on the size of the screen in total, not the size of of a particular overlay for a player in a split screen scenario. The reason for this is most games don’t simply take the single player UI and scale it down. Most of the time the UI was already at the limit of usability at the given resolution, scaling it by 0.5, would/could make it entirely impractical. Most games remove some UI, re-flow things, and scale some things. So it’s not an assumption that would have worked well for the DPI Scale curve to treat a player’s split screen view as if it were just a smaller, weirdly shaped monitor.
You’re welcome to do that though, it’s just on you to either make a custom slate control that does special scaling based on the size of the player’s screen that owns it…etc. Or you could quickly mock it up by wrapping your UI in a ScaleBox, set it to Manual (User Specified) scale, and change the scale according to some logic you setup.
I can see how it wouldn’t be appropriate to always scale depending on the users viewport. Is there anyway to get the DPI scaling system to work in a specified viewport?
It’s alright if it doesn’t, I’ll try out the scalebox method, it sounds the simplest solution for now.
It seems, “Add to player screen” have only done the things about putting the widgets to the correct left top coordinate, a lot of necessary functions are missing to make the whole thing work.
I just found that, this also stop me placing UMG widget into a ratio fixed camera’s screen(not the viewport), in the case there are some black bar appearing in the viewport.
If my understanding is correct, UMG’s calculation and scaling depends on viewport’s condition. I think UE4 should replace the dependency with conditions/parameters of a user specified area, then split screen and ratio fixed player screen can have UMG work alright.
I am pretty new to the UE4 source code, hope some experienced guys introduce this feature into the engine soon.