Unity - Cannot Change Resolution

I have a problem with my resolution settings for the game I am making for Android. Which ever allowed me to do so that it always displayed in 399x639 resolution (for portrait), I tried to change the player’s settings by placing my own resolution and changing it in the code, but didn’t help :( Can anyone understand what might be wrong?

Thanx

0
android screen-resolution resolution unity3d
Apr 16 '14 at 19:36
source share
1 answer

To get started, you can change the resolution, as you said in "Edit"> "Project Settings"> "Player". I think you also know how to change it during development (go to the panel above Game View).

Well, you have to make the game independent of screen resolution. To do this, you can start defining these two variables:

nativeHeightResolution = 1200.0; scaledWidthResolution = nativeHeightResolution / Screen.height * Screen.width 

And in the OnGUI () function, you can write this:

  GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (Screen.height / nativeHeightResolution, Screen.height / nativeHeightResolution, 1)); 

Then, if you want to draw a shortcut, for example, you can use this:

  function Label_Center(pos : Vector2, text : String, style : GUIStyle) { //draw a text label from the center of screen + position, with style GUI.Label(Rect (pos.x + scaledWidthResolution / 2, pos.y + nativeHeightResolution / 2, 700, 100), text, style); } 

This is what I used in my projects. I hope this was helpful to you.

+1
Apr 19 '14 at 2:02
source share



All Articles