- Home /
gui.button not display text and texture
if(GUI.Button(new Rect(Screen.width * 0.4f,Screen.height * 0.01f,
Screen.width * 0.08f,Screen.height * 0.045f),
"Paint",GUI.skin.GetStyle("Paint")))
{
}
this is not working for me.. so i have to use following solution.
function OnGUI ()
{
GUI.Button (Rect (10, 10, 100, 20), "Hello Button!");
GUI.Label (Rect (10, 10, 100, 20), "Hello Text!");
}
can any one help me...
what is Screen.width 0.4f or Screen.height 0.01f ? what do you want to do with it ?
its my location where i want to display my button...
so ok
why you them ! try this : Screen.width/2 that is middle of screen or /3 or /4* and so on :)
screen.width * 0.5 is same as screen.width/2.. you can try this out as well because i am using it since long time and working great for me.
try to solve my question rather than this stuff
Answer by Vipul-Dudharejiya · Jun 03, 2015 at 05:59 AM
Hey I Found Solution for this one... I have used Unity UI method to display Image and text both at the same time...
Answer by Berenger · Jan 13, 2015 at 10:26 AM
If you don't assign your own skin to GUI.skin, then it will be the default one. The default one doesn't have a style "Paint".
here i am assigning my own guy skin as paint which has the image to display in the button and i also want to display text from the perimeter.