-1

I want to make a particle effect in my game when my player hit (OnTriggerEnter2D) a game object, that object explode and make a few particle and after a few seconds those particles absorb by player.

Moein
  • 29
  • 5
  • This is really a broad question without enough information to provide you with a solution perfect for your needs. If you have attempted to do this on your own please provide an example of what you tried, and why it didn't work. This way we can tailor an answer to your needs. – AresCaelum Sep 21 '18 at 13:28

1 Answers1

0
  1. Instantiate GameObjects(particules) when your object is destroyed.
  2. In particules put a script
  3. In Start() method use a Coroutine and set your number of seconds (https://docs.unity3d.com/ScriptReference/WaitForSeconds.html)
  4. In your coroutine method make this object look the player and add a mouvement
  5. When the particule hit the player dertroy it

I hope that will help you.

  • 1
    instantiating a GameObject when a GameObjects destroyed is actually bad, Unity will even through an error at you for doing that. Would be better to create a custom "Death" method, and spawn them there, as OnDestroy is called on every object in a scene when changing scenes, and closing the application. – AresCaelum Sep 21 '18 at 13:37