# Clamp Viewport Aspect Ratio in Shipping Build

**URL:** <https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025>\
**Category:** Programming & Scripting\
**Tags:** viewport, resolution, aspect-ratio, resolution-scale, unreal-engine, question\
**Created:** [January 16, 2025, 6:56pm UTC](https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025 "2025-01-16T18:56:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoahBeggs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoahBeggs](https://forums.unrealengine.com/u/NoahBeggs)\
**Post date:** [January 16, 2025, 6:56pm UTC](https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025/1 "2025-01-16T18:56:49Z")

</div>

Does anyone know a way to clamp the viewport’s aspect ratio on a Windows shipping build?

Would like to prevent the player from increasing Y:X to anything greater than 1:1 (i.e. prevent Y resolution being larger than X).

I know there is a setting in Project Settings called “Allow Window Resize”, which can be unchecked, but I don’t want to prevent any resizing, just want to clamp the aspect ratio.

There is also a console command (r.setRes) which changes viewport resolution and can even be called from a blueprint. I can check the aspect ratio each time the screen resolution is changed, and use this console command to change the viewport dimensions. However my understanding is console commands don’t work with shipping builds (and this solution seems a little hacky anyway)

Anyone know a solution? Something obvious I’m missing?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 16, 2025, 7:14pm UTC](https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025/2 "2025-01-16T19:14:34Z")

</div>

Console command in shipping builds is not hacky at all 🙂

They’re used often.

It might not be with a console command, but I think you do just need to check and correct the screen size. There are blueprint nodes for that

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/d/8/8d80f1e0d2fff8f6e528f216232bb3e89e16213d.jpeg "How To Set/Change Screen Resolution In A Shipped Game (Packaged & Exported) Unreal Engine 4 Tutorial") ](https://www.youtube.com/watch?v=grLDfop6F08)

---

<div class="post-metadata">

**Author:** ![NoahBeggs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoahBeggs](https://forums.unrealengine.com/u/NoahBeggs)\
**Post date:** [January 16, 2025, 9:04pm UTC](https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025/3 "2025-01-16T21:04:48Z")

</div>

Brilliant! Thanks!

There were a couple differences between the linked video and what worked for me (possibly due to differences in engine version, I’m using 5.5.1):

- “Apply Settings” is no longer required after “Apply Resolution Settings”
- Before “Apply Resolution Settings”, I had to add a “Set Fullscreen Mode” node and set it to Windowed. Otherwise, it defaults to full screen.

Here’s a screenshot of my test setup. Works like a charm.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/2/b/f2ba5ba33854816977a436d5552e003f96b2c1ff.png)

Thanks as always @ClockworkOcean !

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 16, 2025, 9:19pm UTC](https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025/4 "2025-01-16T21:19:14Z")

</div>

🤩

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 15, 2025, 9:20pm UTC](https://forums.unrealengine.com/t/clamp-viewport-aspect-ratio-in-shipping-build/2281025/5 "2025-02-15T21:20:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
