using UnityEngine; public class VolumeBarPanel : MonoBehaviour { public GameObject volumeBarPanel; void Start() { // Only autoshow on start scene, otherwise use saved state if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "StartScene") { volumeBarPanel.SetActive(true); UIStateManager.volumeBarVisible = true; } else { volumeBarPanel.SetActive(UIStateManager.volumeBarVisible); } } public void ToggleVolumePanel() { bool newState = !volumeBarPanel.activeSelf; volumeBarPanel.SetActive(newState); UIStateManager.volumeBarVisible = newState; } void Update() { if (Input.GetKeyDown(KeyCode.V)) { ToggleVolumePanel(); } } }