Search Unity

how do i change the gui skins?

Discussion in 'Immediate Mode GUI (IMGUI)' started by even821, Jun 4, 2010.

  1. even821

    even821

    Joined:
    Jun 1, 2010
    Posts:
    38
    i am trying to make a simple gui for my game(its called "Apocalypse"), but i dont like the gui skin wich unity uses. i am pretty sure thers a way to change it but i dont know how.

    please help me, the faith of the apocalypse depends on you :p

    thanks in advance :D
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    You can create a new GUISkin asset from the editor (menu: Assets > Create > GUI Skin) and edit its settings. Then, in your GUI script set the GUI.skin property to your new skin:-
    Code (csharp):
    1. var newSkin: GUISkin;   //  Assign this in the inspector.
    2.  
    3. function OnGUI() {
    4.     GUI.skin = newSkin;
    5. }
     
  3. mojojojo

    mojojojo

    Joined:
    Dec 16, 2009
    Posts:
    138
    I'm lost here. Where do I put that code? Does this involve creating prefabs? Is this only available in Pro? I've got a picture of where I'm at but no clue how I'm supposed to run the code you've got written.
     

    Attached Files:

  4. mojojojo

    mojojojo

    Joined:
    Dec 16, 2009
    Posts:
    138
    I've tried to follow the tutorials but every instance of code I create says it's waiting to compile but never finishes compiling.
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    You can run that code by putting it in a JavaScript file and then attaching that file to a GameObject. Typically, you would create an empty GameObject in the scene (menu: GameObject > Create Empty), and add your GUI code to that.
     
  6. eddieone

    eddieone

    Joined:
    Jul 19, 2014
    Posts:
    8
    I have done this but the skin in the inspector doesn't seem connected to the code. I'm assuming newSkin is what you name the asset as well? What am I missing?
     
  7. eddieone

    eddieone

    Joined:
    Jul 19, 2014
    Posts:
    8
    Scratch that last question. I just tried tried dragging the assent into the variable and oddly enough that worked.
     
  8. s-m-k

    s-m-k

    Joined:
    Oct 26, 2013
    Posts:
    16
    Why does it need to be called in OnGUI? It's BS.