Search Unity

GUI FullScreen Resolution questin/how to ?

Discussion in 'Immediate Mode GUI (IMGUI)' started by MaV3r1cK, Apr 13, 2012.

  1. MaV3r1cK

    MaV3r1cK

    Joined:
    Feb 15, 2012
    Posts:
    26
    Hi :)

    So I am making some 2D Main Menu for my game and I have a question. Is there any way that the main menu can adjust automaticly on resolution and on fullScreen ??

    Thnx :)
    Here is the code :


    function OnGUI()
    {
    if( showWindow == true)
    {
    GUILayout.BeginArea( Rect( Screen.width / 2 - buttonWidth /2 - centerScreen, Screen.height / 2 - 200 , buttonWidth, 400));
    if(GUILayout.Button("Start Game", GUILayout.Height( buttonHeight)))
    {
    Application.LoadLevel("Test_Level");
    }
    GUILayout.Space( spacing);
    if( GUILayout.Button("Multiplayer", GUILayout.Height( buttonHeight)))
    {

    }
    GUILayout.Space( spacing);
    if(GUILayout.Button("Options", GUILayout.Height( buttonHeight)))
    {

    showOption = true;
    }
    GUILayout.EndArea();

    if( showOption == true)
    {
    GUILayout.BeginArea(Rect( Screen.width / 2 - buttonWidth / 2 +100, Screen.height / 2 - 200, buttonWidth, 400));
    if(GUILayout.Button("Windowed ON" , GUILayout.Height( 50)))
    {
    Screen.fullScreen = false;
    centerScreen = 0;
    }
    GUILayout.Space( spacing);
    if(GUILayout.Button("Windowed Off" , GUILayout.Height( 50)))
    {
    Screen.fullScreen = true;
    centerScreen = 400;
    }



    GUILayout.EndArea();
    }
    }
    }