- Home /
How do i make logo scale with screen?
so lets say I have a resolution of 2468 x 860 and I make the resolution 1366 x 786(I made up first resolution, second one is my native)how do I make sure the Powered by unity logo, as well as everything else is scaled to that resolution? here's my current script(I'm in the process of making it).
using UnityEngine;
using System.Collections;
public class MainMenuGUI : MonoBehaviour {
//First Group
public int x;
public int y;
public int width;
public int height;
public Texture newGameButton;
public Texture loadGameButton;
public Texture optionsMenu;
public Texture otherGames;
//Unity Logo
public int x2;
public int y2;
public int width2;
public int height2;
public Texture unityLogo;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
//Main Menu
GUILayout.BeginArea(new Rect(x, y, width, height));
GUILayout.Button(newGameButton);
GUILayout.Button(loadGameButton);
GUILayout.EndArea();
//Unity Logo
GUI.backgroundColor = Color.clear;
GUI.Button(new Rect(x2, y2, width2, height2), unityLogo);
}
}
I want everything to stay in the same area, and scale to the next resolution aswell
bonus points of you can link to everything related to my question.
Answer by NickP_2 · Jun 01, 2014 at 01:24 PM
You can calculate it with the Screen.Width or Screen.Height. For example:
GUILayout.Button("I'm a button!", GUILayout.Width(Screen.Width / 10), GUILayout(Screen.Width /10));
This will make a rectangle button, and no matter what screen size, it will always be the same size relative to your resolution. You can do the same for spacing:
GUILayout.Space(Screen.Width / 10);
or just use
GUILayout.FlexibleSpace()
to center things out.
Don't work, even as seperate class script it say Overload with (1) arguments.