Advertisement
LeeMace

Particle Effect When Sth Destroyed

Aug 9th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | Gaming | 0 0
  1.  //call function where thing is destroyed
  2.  
  3.  [SerializeField] ParticleSystem destructionEffect;
  4.  
  5. private void DestroyWithEffect() {
  6.  
  7.         if (destructionEffect != null)
  8.         {
  9.             ParticleSystem effect = Instantiate(destructionEffect, transform.position, Quaternion.identity);
  10.             effect.Play();
  11.             Destroy(effect.gameObject, effect.main.duration);
  12.         }
  13.         gameObject.SetActive(false);
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement