Search Unity

dind't really understand the GUI

Discussion in 'Immediate Mode GUI (IMGUI)' started by G[3z], Apr 16, 2008.

  1. G[3z]

    G[3z]

    Joined:
    Apr 9, 2008
    Posts:
    46
    i have this (2 cameras)

    and i want it to look like this

    so i created two gui texture from this

    but i can't understand how to put them in place :/
    Red is 150x133 px and should be snapped at the bottom right corner of camera 1
    Blue is 192x193 px and should be snapped at the top left corner of camera 2

    i can't understand how to do that evene after looking at http://unity3d.com/support/documentation/Components/class-GuiTexture.html
    Ty for your help
     
  2. G[3z]

    G[3z]

    Joined:
    Apr 9, 2008
    Posts:
    46
    i made the things work(http://www.g3z.eu/Unity/) buy making a lot of build and moving things one pixel here and one there... but there shoould be a better way.... can't i put a gui layer on the top of both cameras ?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, by using OnGUI, which is always on top of everything. Or using a third camera which is on top of the other two cameras, and only shows the GUI.

    --Eric
     
  4. G[3z]

    G[3z]

    Joined:
    Apr 9, 2008
    Posts:
    46
  5. G[3z]

    G[3z]

    Joined:
    Apr 9, 2008
    Posts:
    46
    fixed
    never call GUI a script :D
     
  6. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    Wel.. you can actually call your script GUI.js, but then you'll have to prefix all GUI calls with the UnityEngine namespace (To tell the compiler you are referencing our GUI class and not the one defined by your script.) :

    Code (csharp):
    1. function OnGUI () {
    2.     if (Time.time % 2 < 1) {
    3.         if (UnityEngine.GUI.Button (Rect (10,10,200,20), "Meet the flashing button")) {
    4.             print ("You clicked me!");
    5.         }
    6.     }
    7. }