how come my particle is not being triggered?

hello peolpe,

so i was working on animation deaths for some things, but have instead opted to go with unity particle effects and play with them instead.
but im just having a bitch of a time getting my particle effect to even play when i collide with say an enemy

ive created a simple emitter just now just so i can get things to work first, then move on with all the other heavier things, but the emitter doesnt kick in at all when the enemy is touched or even when it reaches its death stage

now here is my current code for the bad guy, which has the Transform set to the particle system.

public class EnemyCircleHealth : MonoBehaviour {
   public int circleHealth = 2;
   public int circleHealthScore = 10;
   public Transform explosion;

   void Update () {
      if(circleHealth <= 0){
         Destroy(this.gameObject);
         ScoreManager.score += circleHealthScore;
       }
      if(circleHealth > 2){
         circleHealth = 2;
       }
    }

   void OnCollisionEnter2D(Collision2D enemyCollide){
      if(enemyCollide.gameObject.tag == "Enemy"){
         circleHealth -= 1;
         Instantiate(explosion, transform.position, transform.rotation);
         audio.Play();
       }
   }
}

now i have tried moving all the code away that makes the explosion/particle death to a ‘OnTriggerEnter2D’ but that just isnt working. even doing really simple, but nothing.
im just a bit stuck because nothing is actually working to get the particle to emit.
i was following a brackeys tutorial and have messed with it further because that also did not work

thanks to anyone who can shed some light

anyone? I’m still stuck with this

thanks

Have you placed your particle in the Resources folder?

oooh, nope. to be honest i didn’t realise that things would be specific that much. ill have a go

thanks

for some insane reason its working now, even without moving my prefab particle to Resources. i tested for both folder locations, both came up with the same result. i don’t know what it is , but its exactly the same as it was. very strange indeed

Weird, all I know is that if you are going to instantiate a gameobject you must place it first in the Resources folder, at least for me it never worked the other way around. :slight_smile: Glad you’ve got it working

well i dose a bit moe digging around and messing with it. seems that particles CANT be multiple levels in folders. seem that it can be in one level but no more. resources can be used as and when but notspecificaly

thanks

im still getting used to unitys way f working. ive come more frm the cod based side and falder depth was never a problem unless you coud not remember the names when typing them in to call images or assets :wink:

thanks