我将音频源设置为不破坏,并且它继续播放它设置的原始歌曲,但我无法播放我想要设置的新歌曲。我已经检查了其他问题,并提出了相同的答案并尝试了他们的解决方案,但无法让它发挥作用。
private void Awake()
{
DontDestroyOnLoad(gameObject);
}
private void Start()
{
Load();
audioSource.Play();
cheatCount = 0;
if (volumeOff)
{
AudioListener.volume = 0.0f;
} else
{
AudioListener.volume = 1.0f;
}
}
public void LoadLevel(string name)
{
Save();
Scene current = SceneManager.GetActiveScene();
string currentName = current.name;
lastScene = currentName;
SceneManager.LoadScene(name);
if (name == "Level2")
{
audioSource.clip = Resources.Load<AudioClip>("Audio\\Escape! Soundtrack10");
audioSource.enabled = true;
audioSource.Play();
}
}