Destroying Bullet (Impact Effect)

Hello everyone!

I’m brand new to Unity and coding. I’ve spent the last few days working on my first project, a 2D side scroller. I hit a few bumps in the road that I’ve been working to overcome. One of them I was hoping I could get your help with. For my enemies death along with my bullet impact I added an effect. When the event is triggered the animation holds onto the last frame. It looks like I need to destroy the object with a little bit of a delay? I’m not sure how I would go about that and I was hoping for your help/insight.

Thank you!!

This is the code for my bullet…

https://hastebin.com/ufigepohur.cs

@yaiie_unity I had the same problem as you and then I figured it out. put this in your instantiate code and delete game object code you might have to tweak the time a little for you speed. This also works for your enemy death effect. just use the second script.
impact Effect:
GameObject clone = Instantiate(impactEffect, transform.position, transform.rotation);
Destroy(gameObject);
Destroy(clone,0.35f);

death Effect:
GameObject clone = Instantiate(deathEffect, transform.position, Quaternion.identity);
Destroy(gameObject);
Destroy(clone, 0.35f);