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

28 lines
579 B
C#

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