Cook
Attach particle to another GameObject's action (e.g. Projectile GameObject)
- set the particle GameObject to be a child GameObject of the Projectile
- get the particle from within the Projectile's script:
public ParticleSystem explosionParticle;
- call
Play()
on the object: explosionParticle.Play();
from within the condition that would trigger it. (e.g. on collision of projectile)
- attach the particle GameObject to the Projectile for the
Explosion Particle
param.
public ParticleSystem explosionParticle;
private void OnCollisionEnter(Collision collision) {
if (collision.gameObject.CompareTag("Ground")) {
explosionParticle.Play();
}
}