1. public class ParticSysterm : MonoBehaviour
    2. {
    3. private GameObject BoomExposion;
    4. private void Update()
    5. {
    6. //按下A播放粒子特效并摧毁物体
    7. if (Input .GetKeyDown (KeyCode.A ))
    8. {
    9. ParticleSystem shPTl = BoomExposion.GetComponent<ParticleSystem>();
    10. shPTl.Play();
    11. //使父对象为空
    12. shPTl.transform.parent = null;
    13. //粒子特效播放完成后摧毁
    14. Destroy(shPTl ,shPTl.main.duration );
    15. Destroy(gameObject );
    16. }
    17. }
    18. }