Scriptum/Assets/Scripts/SaveSoundSettings.cs
2022-06-02 10:46:31 +02:00

28 lines
592 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SaveSoundSettings : MonoBehaviour
{
[SerializeField] private Slider volumeSlider = null;
private void Start()
{
LoadValues();
}
public void SaveVolumeButton()
{
float volumeValue = volumeSlider.value;
PlayerPrefs.SetFloat("VolumeValue", volumeValue);
LoadValues();
}
void LoadValues()
{
float volumeValue = PlayerPrefs.GetFloat("VolumeValue");
volumeSlider.value = volumeValue;
}
}