- Home /
Question by
dijital · Mar 27, 2014 at 03:27 PM ·
guiguitexturegui-button
Gui button still visible when texture added.
Hi, im trying to add a texture to a gui button.
I'm using the following code:
public Texture2D image;
void OnGUI() {
if( GUI.Button(new Rect(5, 70, 70, 70), image) ) {
do stuff();
}
But the grey button is still visible, how do I hide it and only have the texture?
Thanks!
screen shot 2014-03-27 at 15.14.13.png
(15.8 kB)
Comment
Best Answer
Answer by FPSworrior · Mar 27, 2014 at 04:14 PM
What you could do is try using a guistyle.
public GUIStyle mystyle;
void OnGUI()
{
if(GUI.Button(new Rect(5, 70, 70, 70), ".",mystyle))
{
DoStuff();
}
}
//When you use the guistyle you have to put on your texture for the button and just make the text color black and the alpha on 0. With the GUIStyle you wont be able to see the grey button. If you have any questions on how to do this just ask me, and I'll help as best I can.
Your answer

Follow this Question
Related Questions
C# GUI keypad 2 Answers
How do I set up a GUITexture as a button? (Java Script) 2 Answers
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
My GUITexture looks awful 2 Answers