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