How to extend HorizontalSlider?


I have a horizontal Slider with fixed width 300. The Problem is, that my SliderThumb cannot be moved to the end. It seems like only the slider texture is 300.

I attach screenshot because of my english its hard to explain the case.

As you can see on the screenshot, the volume slider cannot be moved forward to the right. It looks like its border is set up somwhere in the middle.

Im using custom GUISkin.
Where can i find the option to extend the slider?
Can this be made in GUISkin, or in my script?

`using UnityEngine;

using System.Collections;

public class Options : MonoBehaviour
//these variables are only here because it is cheaper to access a value from memory instead of through a static class
private float screenHeight;
private float screenWidth;
private float buttonHeight;
private float buttonWidth;
public GUISkin guiSkin;
private float mySlider = 1.0f;

// Use this for initialization
void Start ()
	screenHeight = Screen.height;
	screenWidth = Screen.width;
	buttonHeight = screenHeight * 0.15f;
	buttonWidth = screenWidth * 0.3f;		

void OnGUI()
	//in order to use a delegate we just call it like a function. Simple! = guiSkin;
float LabelSlider (Rect screenRect, float sliderValue, float sliderMaxValue, string labelText) {
	GUI.Label (screenRect, labelText);
	// <- Push the Slider to the end of the Label
	screenRect.x += screenRect.width; 
	sliderValue = GUI.HorizontalSlider (screenRect, sliderValue, 0.0f, sliderMaxValue);
	return sliderValue;

//mainMenu only has two buttons in the version, one to play the game, and one to quit the game
void options()
	mySlider = LabelSlider (new Rect (480, 200, 100, 20), mySlider, 300.0f, "VOLUME");
	if(GUI.Button(new Rect((screenWidth - buttonWidth) * 0.5f, screenHeight * 0.4f, buttonWidth, buttonHeight), "BACK"))


Im very new to Unity, so maybe its stupid question, but I will apreciate every answer.

Okay, I think I got it :stuck_out_tongue:

when you make your slider line 32 you set a wrong size, you have to decide whether you set the width parameter in script or in your custom skin.

two solutions:

  1. Set the Slider fixed width to zero in the Custom skin

  2. Retreive the fixed parameter from it and use it when you create your slider:

    mySlider = LabelSlider (new Rect (480, 200, guiSkin.horizontalSlider.fixedWidth , 20), mySlider, 300.0f, “VOLUME”);