using System.Collections; using System.Collections.Generic; using UnityEngine; public class backsound : MonoBehaviour { private static backsound instance; private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); GetComponent().Play(); gameObject.name = "backsound on"; PlayerPrefs.SetFloat("volume", 1); } else { Destroy(gameObject); } } // Update is called once per frame void Update() { GetComponent().volume = PlayerPrefs.GetFloat("volume"); } }