Search Unity

2 Quick GUI Questions

Discussion in 'Scripting' started by GamesOnAcid, Feb 11, 2016.

  1. GamesOnAcid

    GamesOnAcid

    Joined:
    Jan 11, 2016
    Posts:
    283
    2 pretty quick questions, firstly, is there any way to remove the black button around a button, to make it look a little more realistic? (See image as well)
    Code (JavaScript):
    1. (GUI.Button(Rect (Screen.width/2-100, Screen.height/2-400, 120, 50), oneButton));
    Also, is there any way to find a coordinate system easier then guess and check?
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    You could use the "after 4.6" gui system instead of the legacy one
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    To continue with legacy Unity GUI and remove the black button background, specify a different GUI Style, which is typically defined in a GUI Skin. For example, to use the current GUI Skin's "label" style instead of the "button" style:
    Code (csharp):
    1. GUI.Button(rect, oneButton, GUI.skin.label)
    There isn't an easier way to determine GUI element rects.

    I agree with gorbit99's recommendation to switch to the new Unity UI.
     
  4. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    It is sometimes useful to just use the legacy one, so if you want a quick text on your screen and you don't want to mess around with UI, you should use it, but if you want to animate them, give them some 3d feel or just use them quickly, then definetly the new system is the way to go.