Search Unity

[GUI] Why doesn't this work?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Sanity11, Nov 21, 2008.

  1. Sanity11

    Sanity11

    Joined:
    Nov 25, 2007
    Posts:
    96
    I want to have a text appear on the middle of the screen, but I don't get it to work like this:

    Code (csharp):
    1.  
    2. var screenH = Screen.height / 2;
    3.         var screenW = Screen.width / 2;
    4.         GUI.Label (Rect (screenH, screenW, 100, 20), "Druk E om de deur te openen");
    5.  
    Anybody know what I can do about that?

    Thanks!
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Swap screenW and screenH. x is first, y is second.
     
  3. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    For future reference, we have a forum area for UnityGUI questions. Moving this thread in 3... 2... 1...
     
  4. Sanity11

    Sanity11

    Joined:
    Nov 25, 2007
    Posts:
    96
    @StarManta: Thanks, How stupid of me!
    @HiggyB: Thanks, sorry, didn't see that.