- Home /
Question by
karthees · Jan 01, 2014 at 05:45 AM ·
buttonguilayoutgui.button
GUILayout.button size is not changin
I used GUIStyle for button. I used fontsize for change the size of the button. It's not working, also i tried to change the button background texture2D image. It's also not working. Why?
void OnGUI() {
GUI.skin.label = style;
GUILayout.Label("1. Print the alphabet image targets located at", style);
GUI.skin.label = style1;
GUILayout.Label("2. Point any of the animal images", style1);
GUI.skin.label = style2;
GUILayout.Label("3. Finally your kids able to see the 3D animal render on the screen with sound", style2);
GUI.skin.button = startbtnstyle;
GUI.skin.button.fontSize= 30;
if(GUILayout.Button("Start", startbtnstyle)){
Application.LoadLevel("25Nov1");
}
}
startbtnstyle.png
(33.6 kB)
Comment
Answer by Briksins · Jan 02, 2014 at 04:46 PM
You need to set button size as it optional parameters in button constructor
if (GUILayout.Button("Start", startbtnstyle, new GUILayoutOption[] { GUILayout.Width(<your_width_int>), GUILayout.Height(<your_height_int>) }))
Answer by codemaker2015 · Apr 14 at 05:38 AM
Try like this,
if(GUILayout.Button("Start", GUILayout.Width(100), GUILayout.Height(100))){
Application.LoadLevel("25Nov1");
}