1. Submit bugs to enter our 5.4 Beta Sweepstakes. Read more about it here.
  2. Unity 5.4 public beta is now available for all users. Grab the build and visit the 5.4 beta forum.
  3. Missing a module? More about the new installer in 5.3 here.
  4. 4.7.1 released for Xcode 7.3 support. Thread here.

GUI FullScreen Resolution questin/how to ?

Discussion in 'Extensions & OnGUI' started by MaV3r1cK, Apr 13, 2012.

  1. MaV3r1cK

    MaV3r1cK

    Joined:
    Feb 15, 2012
    Messages:
    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();
    }
    }
    }