Hey guys so I have a problem I managed to make a slider to adjust the audio, works fine but only for main menu. I can’t get it to work for the mouse sensitivity. Also how do I for example adjust the audio from 1 scene but need to adjust volume from another scene? Here is my code:
using UnityEngine;
using System.Collections;
public class OptionsScript : MonoBehaviour {
//used to adjust value of slider
float hSliderValue = 1.0f;
float MSliderValue = 1.0f;
void OnGUI()
{
//makes a new slider
hSliderValue = GUI.HorizontalSlider(new Rect(650, 300, 100, 30), hSliderValue, 0.0f,1.0f);
//this is used a label to show user it changes volume
GUI.Label(new Rect(520,293,200,20), "Change game volume");
//with this get the audio source component and change the variable value
GetComponent<AudioSource>().volume = hSliderValue;
//this below is for the mouse sensivity
MSliderValue = GUI.HorizontalSlider(new Rect(653, 330, 100, 30), MSliderValue, 0.0f, 1.0f);
//this is used a label to show user it changes mouse sensitivity
GUI.Label(new Rect(500, 323, 200, 20), "Change mouse sensitivity");
}
}