- Home /
How to make texture fit in GUI button?
i have a button and texture is small it dosen't fit into the whole button i have to make it to fit in the button.Is there any way of doing this without changing to GUI box?
Thanks
Answer by Swaminathan · Mar 20, 2014 at 07:22 AM
Use GUIStyle for applying Texture to a button.
Instead of using Texture2D try using GUIStyle and add your custom Style.
Sample code:
var style_1:GUIStyle;
GUI.Button(Rect (0,0,100,100),"",style_1);
then click and drag your custom texture to the button.
If u have doubt follow this link:
http://docs.unity3d.com/Documentation/Components/class-GUIStyle.html
hope this may help you.
Your answer
Follow this Question
Related Questions
Make more buttons appear, on button click. 1 Answer
Null reference exception[SOLVED] 1 Answer
Button Texture Issues?? 1 Answer
how to change a gui button texture 1 Answer
proper inventory system issue.. 1 Answer