How to make a Horizontal Slider slide between resolutions?

I just cant imagine how to do it. What I would like, is a horizontal slider, that you can slide with to choose resolution. Then you click a button and it will apply what you have chosen. Any ideas? I’ve look at docs and googled something similar, but my mind just cant imagine it. Any help appreciated, thanks in advance. Last resort is to use a ton of buttons, but that’s just… weird… lol.

Building up on tbkn’s answer. You can get all the available resolutions wwith Screen.resolutions (an array of type Resolution). You can then create a variable that is modified by the HorizontalSlider and is used as an index to point values in the Screen.resolutions array:

var resolutionPointer:int=0;

function OnGUI(){
    Screen.SetResolution(Screen.SetResolution(Screen.resolutions[resolutionPointer].width,Screen.resolutions[resolutionPointer].height,true); ,true);      

x= Number Of Resolution

Create a GUI slider just like you would any other say for volume

I dont know how to make an option for resoltion but Im sure you can find out how on here.

But I would assign a value to each resolution
480p = 1 ;
720p = 2 ;
1080p = 3 ;

Im pretty sure the slider will snap to 1 2 3 based on how you write the var

First, to find out how to change resolutions, read here:

Second, you just have to create a GUI slider component:

Now all you have to do is connect the two. In a script, create a slider, and give it min value 0 and max value equal the number of resolution options you have. Now in that script, check the value of the slider, rounded down to the latest whole number. When the player clicks apply, change resolution based on that number.

Sample code:

public class ResolutionSelector : MonoBehaviour {
	public float hSliderValue = 0.0F;
	public int[,] resolutions = { {640, 480}, {1280, 1024}, {1920, 1080} }
	void OnGUI() {
		hSliderValue = GUI.HorizontalSlider(new Rect(25, 25, 100, 30), hSliderValue, 0.0F, 3.0f);
		if (GUI.Button(new Rect(25, 70, 100, 30), "Apply")) {
			int resolutionIndex = Mathf.FloorToInt(hSliderValue);
			Screen.SetResolution(resolutions[resolutionIndex, 0], resolutions[resolutionIndex, 1], true);