- Home /
Which Is The Actual Game?(Max or no Max Screen)
This is a ignorant question and might seem confusing to many, but what screen is the actual game(meaning which one will you see on the actual device's screen). I have my screen/game window set to Ipad Wide (1024x768). When I click maximize on play, the textures for the main menu become bigger to where they're bigger than the title, and when I don't click maximize on play they stay the same size as when viewing in small screen. So which one will I see on a Ipad Wide 1024x768? Or which one is right? Hope you guys understand me, and sorry again for the ignorant question.
Answer by Kossuranta · Aug 16, 2014 at 02:28 AM
It won't scale anything bigger than resolution you have set, but when it uses lower resolution there should be text "Using resolution x" on top left corner of the Game screen.
Basically GameObjects will scale on resolution changes, but GUI won't if not set. This will be problem if you try to run your game on different resolutions (on bigger resolutions GUI will be small and on small resolutions GUI will be big).
Here is a good script for scaling GUI from SilverTabby in JavaScript:
var native_width : float = 1920;
var native_height : float = 1080;
function OnGUI ()
{
//set up scaling
var rx : float = Screen.width / native_width;
var ry : float = Screen.height / native_height;
GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (rx, ry, 1));
//now create your GUI normally, as if you were in your native resolution
//The GUI.matrix will scale everything automatically.
//example
GUI.Box( Rect(810, 490, 300, 100) , "Hello World!");
}
http://answers.unity3d.com/questions/169056/bulletproof-way-to-do-resolution-independant-gui-s.html
And my translation to C#: float native_width = 720; float native_height = 1280;
void OnGUI()
{
float rx = Screen.width / native_width;
float ry = Screen.height / native_height;
GUI.matrix = Matrix4x4.TRS (new Vector3(0f, 0f, 0f), Quaternion.identity, new Vector3(rx, ry, 1f));
GUI.Box(new Rect(810, 490, 300, 100), "Hello World!");
}
Ah so that's why some of my GUI went to the side. By the way, do you have that script in C#? I don't do Java.
Never $$anonymous$$d, I'm just sticking with what I got for now. After all, my game is simple as can be.
Thanks a bunch. Although GUI $$anonymous$$atrix does seem a little too advanced.
Your answer
Follow this Question
Related Questions
how I can change the screen resolution in real time? 1 Answer
Forcing an resolution for all android and iphone screens 1 Answer
How to make game recognise Screen resolution on startup 1 Answer
Position GameObject to Bottom Left Corner 2 Answers
Why won't my Player Setting's resolution size change after build/export? 0 Answers