- Home /
Bigger size button help
How can I make the button of the slider a Bigger size. is too small.
private var hSliderValue : float = 0.0;
private var myAnimation : AnimationState;
function Start(){
myAnimation = animation["Take 001"];
}
function LateUpdate() {
myAnimation.time = hSliderValue;
myAnimation.enabled = true;
animation.Sample();
myAnimation.enabled = false;
}
function OnGUI() {
// Horizontal slider
//GUI.Box (Rect(0, Screen.height - 40, Screen.width, 40),"");
GUILayout.BeginArea (Rect (60,Screen.height - 30,1220,60));
hSliderValue = GUILayout.HorizontalSlider (hSliderValue, 0.0, myAnimation.length, GUILayout.Width(800.0f));
GUILayout.EndArea ();
}
Answer by ryisnelly · Aug 05, 2013 at 02:41 AM
var hSbarValue : float;
function OnGUI () {
hSbarValue = GUI.HorizontalScrollbar (Rect (25, 25, 100, 30), hSbarValue, 1.0, 0.0, 10.0);
}
Answer by feds · Jan 19, 2018 at 11:17 AM
Simply change the fixedHeight of the Slider and the SliderThumb, in this example I'm setting this for 6% of the screen size;
h = Screen.height;
GUI.skin.horizontalSlider.fixedHeight = h * 6 / 100;
GUI.skin.horizontalSliderThumb.fixedHeight = h * 6 / 100;
It will make the Slider and the Button bigger ;)
Ps. For mobile I added an extra line for widht:
GUI.skin.horizontalSliderThumb.fixedWidth = wh* 2 / 100;
Another important point don't forget to make the SliderBox Height to be proportional to the screen otherwise it will be printed as a big component but the button will be really hard to receive focus to be dragged.
Your answer
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Making a Hover function for a button or toolbar from code. 2 Answers
Screen Sizes - HUD - Button Layout - Camera. 0 Answers
Question about positioning GUI. 1 Answer
Button reaction time problem 1 Answer