- Home /
Unitys Particle System wont work like i want
My Bullet in my Game has an death effect
using System.Collections; using System.Collections.Generic; using UnityEngine; public class BulletController : MonoBehaviour { public float lifeTime; public ParticleSystem deathParticle; private void Start() { Physics2D.IgnoreLayerCollision(7,7); Physics2D.IgnoreLayerCollision(7,6); Physics2D.IgnoreLayerCollision(7,8); StartCoroutine(DeathDelay()); } private void OnCollisionEnter2D(Collision2D other) { if(other.gameObject.CompareTag("Targets")) { Instantiate(deathParticle, transform.position, Quaternion.identity); Destroy(gameObject); } } IEnumerator DeathDelay() { yield return new WaitForSeconds(lifeTime); Instantiate(deathParticle, transform.position, Quaternion.identity); Destroy(gameObject); } }
The Bullet and the Death Effect are both Prefabs. But the Problem is, that the Death effect doesnt even play when i dont activate "Play on Awake" and when i activate it then the Effect plays nicely at the start but when it should play then it stops after half of the time (1s) and dissapears.
I will put an Screenshot of my Particle effect
[1]: /storage/temp/172032-image-1.png