Question by
fabianpng55 · Aug 25, 2020 at 03:38 AM ·
triggerparticlescollision detection
Particle play back
//Hi, I am making a space shooter game and upon shooting the asteroid, it is suppose to play the explosion particle. I've assigned the particle in the inspector as well but it simply doesn't play the explosion. I've tried moving the eExplosion.Play() before Destroy(gameObject) and it does not work too Thanks in advance for the help
public class DetectCollision : MonoBehaviour {
public bool gameOver;
public float scoreValue = 0;
public ParticleSystem eExplosion;
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("RedAsteroid") && gameObject.CompareTag("RedProjectile"))
{
GameGUI.Score += 10;
Destroy(gameObject);
Destroy(other.gameObject);
}
if (other.gameObject.CompareTag("BlueAsteroid") && gameObject.CompareTag("BlueProjectile"))
{
GameGUI.Score += 10;
Destroy(gameObject);
Destroy(other.gameObject);
eExplosion.Play();
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613010443im_/https://answers.unity.com/themes/thub/images/avi.jpg)