刚开始时,我的代码是这样的:
private void OnTriggerEnter(Collider other)
{
if(other.tag=="Player")
{
this.gameObject.GetComponent<ParticleSystem>().Play();
this.gameObject.GetComponent<AudioSource>().Play();
Destroy(gameObject);
}
}
(ParticleSystem和AudioSource都是GameObject的组件)
于是,就导致了GameObject已经销毁了,但粒子和音效都还没有播放的后果,经多方请教后,终于找到了原因:GameObject的销毁速度远