Set UMG Aspect Ratio to Camera?

I am currently making a bullet hell game that uses a more traditional view layout that is quite different from most games.
For reference, most traditional looking bullet hell games on PC have a viewport that looks something like this:

As can be seen in this image specifically, the viewport consists of a vertically-oriented playfield with the rest of the 4:3 aspect ratio consisting of the HUD.

Because of this, my current map setup uses a static camera with a 2:3 aspect ratio in game, as shown below:

So far this has worked exactly as intended, with the game running in 16:9 and other resolutions with everything outside of the view of the camera being rendered as black, as shown below:

However, the problem comes when trying to add UMG elements that are meant to be constrained to the camera’s aspect ratio.
Below is an example of how I have tried to setup a UMG of the enemy healthbar so that it is constrained to the 2:3 aspect ratio of camera:

However, ever I try to create the UMG widget and add it to either the viewport or playscreen from within the Camera’s blueprint, the UMG defaults to the aspect ratio of the entire viewport rather than just the camera in question, as can be seen with the clipping outside of the camera’s view below:

It should also be noted that if in the UMG designer I switch over to the graph editor, the aspect ratio for the canvas panel I had previously set to 2:3 reverts back to 16:9, and I can’t find any way to force it to remain in 2:3.

I have tried to find workarounds to this through experimentation to no avail, and have tried to look for a solution online, but because this is such a niche issue that only really applies to a very niche genre of game, I haven’t found anything.

Is there anyway to solve this issue, either by forcing the canvas panel to remain in 2:3 at all times, or by making it so that the widget is drawn into the camera’s viewport specifically rather than the game windows? And if so, how would I go about doing this?

Thank you!

I have figured out a solution to this issue, so I will provide it here in case anyone in the future wants to know:

Under the default canvas panel, add another canvas panel and set it it’s dimensions to be the same as the camera’s ratio sized to fit the default canvas panel. Then add the relevant elements, in this case the health bar and text, to the child canvas panel, and it should be drawn to the to the camera’s ratio as intended.

2 Likes