so, im trying to make a explosion particle appear once when the bullet hits any collider. i used instantiate to make the explosion particle appear when its called but the particles do not appear, instead the instance of it is just created without the particles being animated.
tried to put (ParticleSystem.enableEmission = True) somewhere but the code would always come up with some syntax error or something… im still a beginner in programming. So how can i put that in the code? or, is there a better way to achieve the result i want? thanks in advance!
my script used on the bullet prefab:
public class blueLaserScript : MonoBehaviour
{
public ParticleSystem explosionParticle;
public int dmg = 1;
public float lifeTime = 3f;
public float maxLifeTime = 0.35f;
void Start()
{
lifeTime = maxLifeTime;
}
void FixedUpdate()
{
if (lifeTime > 0)
{
lifeTime -= Time.deltaTime;
}
else
{
Destroy(gameObject);
}
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.isTrigger == !true && !col.CompareTag("Enemy"))
{
Instantiate(explosionParticle, transform.position, transform.rotation);
Destroy(gameObject);
}
if (col.isTrigger == !true && col.CompareTag("Enemy"))
{
col.SendMessageUpwards("Damage", dmg);
Instantiate(explosionParticle, transform.position, transform.rotation);
Destroy(gameObject);
}
}
}