Hello everyone. I am newbie to Unity and Android developent, and I am in need of your help to make my GUI controls resolution independent. I have posted the same question on the Android development forum (GUI and Android dev), but I got not responce, so I am posting here with code, for better.
I have a GUITexture in my scene to be used as a graphical background for a controller, and above this, a set of GUI buttons is rendered in absolute x,y screen positions. Those two elements rendered together makes the buttons controller for my android application, in a 480x320 HVGA Landscape screen resolution(see image 1):
The problem is that if the resolution is changed to 800x480 WVGA Landscape, everything is meshed up as you can see in the following screenshot:

I have tryed to make use of the Matrix4x4 to keep the GUI buttons scaled to a new resolution, but I still get them scattered all around screen.
Could anyone be kind enough to give some advise or maybe a code snippet on how to make both GUI buttons on absolute possitions and GUI Texture, screen resolution independent?
These is the script for rendering the GUIButtons above GUITexture:
using UnityEngine;
using System.Collections;
public class GUIButtons : MonoBehaviour {
public Texture btnTexture1;
public Texture btnTexture2;
public Texture btnTexture3;
public Texture btnTexture4;
public Texture btnTexture5;
public Texture btnTexture6;
public Texture btnTexture7;
public Texture btnTexture8;
void OnGUI()
{
if (!btnTexture1) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.Button(new Rect(68, 219, 50, 35), "");
if (!btnTexture2) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.Button(new Rect(130, 219, 50, 35), "");
if (!btnTexture3) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.Button(new Rect(68,262,50,35), "");
if (!btnTexture4) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.Button(new Rect(305, 219, 50, 35), "");
if (!btnTexture5) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.RepeatButton(new Rect(366, 219, 50, 35), "");
if (!btnTexture6) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.RepeatButton(new Rect(130,262,50,35), "");
if (!btnTexture7) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.Button(new Rect(305, 262, 50, 35), "");
if (!btnTexture8) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.RepeatButton(new Rect(366, 262, 50, 35), "");
}
}
Thank you all in advance for your answers.
