This is my code that I wrote. My question is How do I get it it re size when I change off of Free Aspect. For example 1024 X 768 shows Like how I have it set up in the scene. but when I change to 1920 X 1080 All my GUI is off center. I have done a google search but so far I have not been able to get anything to work. If you have a link that will help me I can research it on my own I have not issue with that. \
Also I have many topics on how to re scale a texture that is attached to a object. But this is not my case. I am drawing my GUI from code. As of now the only way I see the GUI in my game window is when I hit play.
using UnityEngine;
using System.Collections;
public class MyGUI : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// Void OnGUI() is the function for your Graphic user Interface (GUI)
void OnGUI(){
// Make a backgroud for the button.
// GUI.box = A box is created / new Rect() = A new Rect is created / new Rect(10(top left), 10(top right), 100(width), 100(height)) In pixels.
// "Main Menu" is what will be displayed at top of the box.
GUI.Box (new Rect(460, 10, 100, 200), "Main Menu");
// Make a button that can be clicked on.
// Debug.Log() creates text in your console.
// Application.LoadLevel(); Takes you to what ever scene that you tell it to. scene number goes in () after LoadLevel.
if (GUI.Button (new Rect (470, 55, 80, 20), "Options")) {
Debug.Log ("Options");
//Application.LoadLevel(1);
}
if (GUI.Button (new Rect (470, 75, 80, 20), "Credits")) {
Debug.Log ("Credits");
//Application.LoadLevel(1);
}
if (GUI.Button (new Rect (470, 95, 80, 20), "Exit")) {
Debug.Log ("Exit");
//Application.LoadLevel(1);
}
if (GUI.Button (new Rect (470, 35, 80, 20), "New Game")) {
Debug.Log ("Loading New Game");
Application.LoadLevel(1);
}
}
}