Search Unity

why donot the button have the border when i use GUIStype

Discussion in 'Immediate Mode GUI (IMGUI)' started by onunix, Feb 26, 2015.

  1. onunix

    onunix

    Joined:
    Feb 20, 2015
    Posts:
    5
    why donot the button have the border?

    mycode is:


    my code is GUIStype mystyle = new GUIStyle();
    mystyle.fontsize = 50;
    GUI.Button(new Rect(0,0,50,50),"i",mystle)

    when i changed to

    GUI.Button(new Rect(0,0,50,50),"i"), the border appeared, but the font size was too small,how to deal with it,thanks.
     
    Last edited: Feb 27, 2015
  2. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Button borders are graphics and by creating a new (emtpy) GUIStyle, you don't have any set. Try

    Code (csharp):
    1.  
    2. var myStyle=new GUIStyle(EditorStyles.button);
    3. // make some changes to font size etc...
    4.