Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

working but not vivible button?

Discussion in 'Immediate Mode GUI (IMGUI)' started by DrFromTheLab, Jan 3, 2011.

  1. DrFromTheLab

    DrFromTheLab

    Joined:
    May 21, 2009
    Posts:
    108
    Hi,

    is there an option to use the GUI.Button but without drawing it?

    I mean something Like this:
    Code (csharp):
    1.  
    2.         if (GUI.Button(new Rect((0,0,128,50),"",CustomStyle_invisibleButton))
    3.         {
    4.             DoSomething();
    5.         }  
    6.  
     
  2. beckett230

    beckett230

    Joined:
    Jun 30, 2010
    Posts:
    262
    Hello, this code should work.

    Code (csharp):
    1.  
    2. var newSkin : GUISkin;
    3.  
    4. function OnGUI ()
    5. {
    6.                                 //Change the Buttons 2d Texture to none, so you do not see the button.
    7.                                 GUI.skin = newSkin;
    8.         if (GUI.Button(new Rect((0,0,128,50), "Hello"))
    9.         {
    10.             DoSomething();
    11.         }  
    12. }
    13.  
     
  3. DrFromTheLab

    DrFromTheLab

    Joined:
    May 21, 2009
    Posts:
    108
    ok never tried it without a texture.... good this works :) thanks!!