Hello! I require a in-game volume slider that will adjust the games volume.
I know that I have to use AudioListener.volume(i think, right?), but how to i put that into c# to edit the volume!
Thank you in advance!
Hello! I require a in-game volume slider that will adjust the games volume.
I know that I have to use AudioListener.volume(i think, right?), but how to i put that into c# to edit the volume!
Thank you in advance!
using UnityEngine;
using System.Collections;
public class VolSlider : MonoBehaviour
{
float s = 1.0F;
AudioListener main;
void Start()
{
main = Camera.main.GetComponent<AudioListener>();
}
void Update()
{
main.audio.volume = s;
}
void OnGUI()
{
s = GUI.HorizontalSlider (new Rect(0, 0, 256, 32), s, 0.0F, 1.0F);
}
}