Only 1 resolution.

Hello, How can I make a scene(a menu), only run in a certain resolution? I want this because my menus look best at a certain resolution, and look horrible and distorted in others. :wink:

Thanks

are you using absolute positioning? you can do some math with the Screen.height and Screen.width stuff, but if you dont want to change it, Unity - Scripting API: Resolution use the “height” and “width” stuff in the Awake function

You don’t want that, because people use all sorts of different screen resolutions and generally don’t want to be stuck with just one, since it’s good odds it won’t match whatever screen they’re using. Program your menus so they work in any resolution.

–Eric

How do i do that? I have a script that changes the ratio to match screens(1:3365), but, it only looks good up to about 1280x990(something like that) resolution. higher than that, the background image goes distorted. :frowning:

you mean the image sets all pixely, or it gets stretched, or something?

It gets stretched. :frowning:

hmm. can i see the script

Scale(ratio) script:

// Use this on a guiText or guiTexture object to automatically have them

// adjust their aspect ratio when the game starts.
var m_NativeRatio = 1.3333333333333;
   
currentRatio = (Screen.width+0.0) / Screen.height;
transform.localScale.x *= m_NativeRatio / currentRatio;

Hello?