1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Reddit AMA with Adam Myhill on Cinemachine, Thurs July 27 - 10AM PT. More info.
    Dismiss Notice
  6. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  7. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    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();
    }
    }
    }