Death with particle effect.Still need Help!

Hi guys,im making roll the ball game,anyway when my ball falls off from level,it gets destroyed,or when im hiting some obstacles it gets destroyed too.Well I want to make it better,i want particle effect plays when i get destroyed-(‘‘Dead’’),(particle effect plays just some seconds when i get destroyed).
Please help me at this.Thanks for attention :slight_smile:

Use the Instantiate command, when the ball gets destroyed.

You add a ParticleEffect to your scene, but you disable emitting. (particleEmitter.emit = false;)

Now, when you want the particle to show, you simple set particleEmitter.emit = true;
If the particle needs to follow your ball, you could add the particle as a child of the player. That way the effect will always follow your player.

Also experiment with the simulation space. If you want your particles to actually animate in world space, you will need to set it that way.

If the simulation space of the particle is set to local, and your ball moves while emitting, the particle will not emit in a realistic way because it is moved.

Experiment with this stuff and you can create some really cool effects for your ballgame.

Cheers :wink:

Here is my Death script:

public void Death()
{
	audio.clip = DestroySound;
	audio.Play();
	Time.timeScale = 0f;
	death = true;
}

}

An there is second death script:

if (other.tag == "Destroy")
{
     _GameManager.GetComponent<GameManager>().Death();
     Destroy(gameObject);
}

I Dont know how to modify it like as your example,so can you please help me to do this?
Pay attention on time scale,i want that time scale dont affect the particle effect,but i also want it Of.

Hey guys, I’m still relatively new to C# and Unity as a whole, but I’m making a simple 2D game and I solved the problem of death effects by adding an empty game object into my scene called DeathEffect, then creating a prefab of it. I then attached this code to my player:

public GameObject deathEffect;



	void OnCollisionEnter2D(Collision2D col){
		if (col.gameObject.name == "FlyingSquid") {
			Instantiate (deathEffect, col.gameObject.transform.position, col.gameObject.transform.rotation);
			Destroy (col.gameObject);
		}
	
	}

Then I just stuck my DeathEffect object into the public GameObject deathEffect slot on my script component. I hope this noob knowledge helps someone:)

No no no, I have the same problem, but I need to:

1: disable my 2d sprite renderer
2: play the particle effect
3: wait until particles gone
4: reset players position and also entire map “running” stuff

All of those things i can do, my isue is:

1: it dont disable the sprite renderer
2: it plays the particke effect to late
3: it never wait, it restart instantly dies and then display particles
4: it restet the player position, but again, instantly