我想将AudioSource(Clicksound)更改为其他AudioSource(DrumSound) 当游戏过程中点击ui按钮时。代码运行但是AudioSource的更改从不会从ClickSound更改为Drumsound,下面是我使用的代码
AudioSource Sound;
public AudioSource DrumSound;
public AudioSource ClickSound;
void Start () {
Sound = ClickSound;
Time.timeScale = 0;
}
public void drumClicked()
{
Sound = DrumSound;
SettingCanvas.SetActive (false);
}
public void OnTriggerEnter2D(Collider2D col)
{
if (col.tag == "Piviot" && Time.timeScale != 0) {
Sound.Play ();
}
}