using UnityEngine; using System.Collections; public class DestroyParticle : MonoBehaviour { void Start() { //开启协程 StartCoroutine(CreateParticle()); } IEnumerator CreateParticle() { //当粒子还在播放中 while (gameObject.GetComponent().isPlaying) { yield return null; //条到下一帧 } Destroy(gameObject); //粒子播放结束 } }