Hi,
In unity i put a 16/9 aspect ratio, now i set my GUI textures according to the view i get when I press play (maximize).
Now in project settings > Input i set to 16/9 aspect ratio only
When i start the .exe i see that the GUI textures aren’t in the right place meaning the resolution isn’t the same.
How come?
Why can’t we have some sort of “show safe frame” inside Unity.
Thanx
h20
16:9 in the editor means that the view is cut to the max 16:9 window that fits into this window size.
if you want it on the build exe you must use the Screen class and change the actual resolution again to a 16:9 format
The setting there on the game window has no importance nor any impact on any build, just to mention that. its only there to give you a possibility to test your setup in different screen formats so you know what your end users will get on their 4:3, 16:9 and 16:10 screens
ok so
i want a 16/9 view when people run my exe. SO what do i do?
and how do i keep my GUI textures in the same place then
If you want a 16:9 view when the users use your exe you have 2 ways:
-
Disable the startup screen and offer screen resolution selection only from within your game. Only offer 16:9 resolutions there
-
Allow them to use whatever they want but alter the normalized view rect of your camera to a 16:9 ratio and ensure that your gui stuff is positioned in relation to the view rect
I personally would though recommend to do neither of that.
people hate nothing more than devs that enforce resolutions especially if their aspect ratio is different.
either offer all resolutions or get your UI in to 4:3 compliance and offer only 1024x768 windowed as it is standard for casual games or get your gui setup to work in a smart way and position the element basing on the left and right border of the window
ok,
but in the project settings input you can just check 16/9 aspect ratio
Then when you start the .exe you only have 16/9 resolution possibilities.
I have no idea what you talk about but I know that there is no way to enforce such a restriction without you implementing it yourself for an in-player option menu
well according to me there is
edit > project settings > player
and then in SUpported Aspect Ratios you can check/uncheck
Right?
edit: it’s strange because even with the 16/9 resolutions is shows me the icons don’t stay at same place
Thats right on 2.6.1 that option actually is there, sorry.
as for them not staying at the same place: potentially your code for the ui is buggy, that you assumed a fixed resolution, not 16:9 ratio actually.
if thats the case then you will have to rewrite the setup logic as whole
the only thing not staying in place is the icons i made and slipped inside GameObject > Create other > GUI texture
Even in Unity when i movethe GAME window which is set to 16/9, the GUI textures don’t follow
GUI textures are not the same as gui stuff.
they are positioned in 3D transforms.
mixing them with OnGUI (real gui) can cause some hickup.
what are you doing with them? if it is to overlay something in an ongui window etc, don’t use them. use labels with textures for example or GUI.DrawTexture
ok so you are saying that i can’t use GUI textures?
you can use whatever you want, you just have to tell your code how to handle it correctly
there is no code behind this.
check it in your Unity
You will see that in Texture you can simply slide in a jpg, png whatever…
And then in Pixel inset, change the settings