Skip to content

Getting UI & Camera to respect aspect ratio in Editor


While developing a stream overlay, being able to see the position the UI will sit when the game would be played at 16:9 fullscreen was important. However, by default, when playing in editor – the UI and Camera will fill the viewport. So how can we change this?

Thanks to some advice from the lovely people on BenUI’s discord server, I learned the following trick.

  1. On your camera, check “Restrict Aspect Ratio”
  2. When creating and adding the widget, use the AddToPlayerScreen function (as opposed to more common AddToViewport).

As a result, regardless of the size of your viewport when playing in editor, you will have the camera limited to its aspect ratio and any widgets added will be confined to the camera’s screen space.

You can see the difference in the images below:

RestrictAspectRatio = false, AddToViewport
RestrictAspectRatio = true, AddToViewport
RestrictAspectRatio = true, AddToPlayerScreen

Hopefully this helps someone who was getting as confused as I did!

[Last Updated for UE 5.4]

Return to top


Leave a Reply

Your email address will not be published. Required fields are marked *

2024 © HonestDanGames