17 lines
355 B
C#
17 lines
355 B
C#
// Example: Save and Load Player Preferences
|
|
|
|
using UnityEngine;
|
|
|
|
public class SettingsManager : MonoBehaviour
|
|
{
|
|
public void SaveVolume(float volume)
|
|
{
|
|
PlayerPrefs.SetFloat("Volume", volume);
|
|
PlayerPrefs.Save();
|
|
}
|
|
|
|
public float LoadVolume()
|
|
{
|
|
return PlayerPrefs.GetFloat("Volume", 1.0f);
|
|
}
|
|
} |