Search Unity

Particle System Collision/Kill Player

Discussion in '2D' started by iningomontoya, Aug 9, 2017.

  1. iningomontoya

    iningomontoya

    Joined:
    Jul 27, 2017
    Posts:
    21
    I would like to be able to setup a particle effect that would kill the player on contact. I have the scripting setup to use a tag to kill the player. This strategy does not work on particle effects. I have seen advise online about how to to do this but the information may be obsolete because none of that code such as using OnParticleCollision seems to work.

    Here is the portion of the script that works with the tags if that is helpful.

    Code (CSharp):
    1. void OnCollisionEnter2D (Collision2D other)
    2.      {
    3.  
    4.          if(other.gameObject.tag == "killbox")
    5.      {
    6.        
    7.         theGameManager.RestartGame();
    8.         moveSpeed = moveSpeedStore;
    9.         speedMilestoneCount = speedMilestoneCountStore;
    10.         speedIncreaseMilestone = speedIncreaseMilestoneStore;
    11.         deathSound.Play();
    12.  
    13.     }