1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. Unity 5.6 is now released.
    Dismiss Notice
  3. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice

GUI FullScreen Resolution questin/how to ?

Discussion in 'Extensions & OnGUI' 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();
    }
    }
    }