When I dynamically replace the events in sudioeventemitter, the previous music will be played agpublic
class test : MonoBehaviour
{
public Button a;
public Button b;
public StudioEventEmitter s;
public void Start()
{
a.onClick.AddListener(()=>{
Play();
});
b.onClick.AddListener(()=>{
Stop();
});
}
public void Play()
{
s.EventReference.Path = "event:/BGM/system/yongyan_theme";
s.EventReference.Guid = RuntimeManager.PathToGUID("event:/BGM/system/yongyan_theme");
s.Play();
}
public void Stop()
{
s.Stop();
s.EventReference.Path = "event:/BGM/system/lobby";
s.EventReference.Guid = RuntimeManager.PathToGUID("event:/BGM/system/lobby");
s.Play();
}
}ain