1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  3. All Unity Pro perpetual license customers: your special offer to subscribe is ready! Click here.
    Dismiss Notice
  4. Unity 5.5 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  6. Unity 5.6 beta is now available for download.
    Dismiss Notice
  7. Get prepared for the Tizen Mobile App Incentive Program! Read more about the upcoming program here.
    Dismiss Notice
  8. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
    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
    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();
    }
    }
    }