Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to destroy particle sys on trigger enter and activate explosion particle system.

Discussion in 'Scripting' started by cyboerg, Feb 25, 2015.

  1. cyboerg

    cyboerg

    Joined:
    Jan 28, 2015
    Posts:
    9
    Hello guys, Im new to coding and im trying to make a fireball projectile.

    I have my fireball prefab with the fireball particle effect.
    It has a script applied that disables the emission when it collides with a wall.

    But after disabling the fireball effect I want it to enable an explosion effect.

    How do I do that?

    Should I give the prefab a sub gameobject with the explosion effect and assign it a script that looks for when fireball particle effect is disabled and then enables the explosion?

    Thanks in advance.
     
  2. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,356
    Have a look in the asset store for fx fume fx by fx kandol effects its a free asset and has a particle effect with a fireball and explosion might give you some insight.Also a fireball effect on the elementals pack which has a fireball that explodes on impact
     
    Last edited: Feb 25, 2015
  3. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,008
    The easiest way would probably be to set both the fireball and the explosion as children of an empty parent gameobject. Then attach a script to the empty parent which destroys the fireball gameobject upon collision and activates the explosion gameobject. The explosion gameobject might also destroy the parent gameobject after a certain period of time, which would remove all three after the explosion is finished.
     
  4. cyboerg

    cyboerg

    Joined:
    Jan 28, 2015
    Posts:
    9
    I have a fireshield prefab that gets instantiated on click and on this fireshield prefab I want the particle effect prefab to be instantiated.

    Is that a good way of doing it?