Hello,
I’ve ran into a problem with the particle system. I have an object that when it gets destroyed it explodes and i play a particle system. This works on the first load, but when i restart the level the next time it dies the particle ystem does not activate.
This is the restart :
if (GUI.Button (new Rect (411, 311, 311, 111), "Restart"))
{
Application.LoadLevel("MainGame");
}
And this is the destroy function
using UnityEngine;
using System.Collections;
public class Destroy : MonoBehaviour {
private Timer managerScript;
public ParticleSystem death;
void Start () {
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
managerScript = gameControllerObject.GetComponent <Timer>();
death.Stop();
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D other){
Debug.Log(other.gameObject.name);
if (other.gameObject.tag.Equals("Enemy")){
managerScript.showMenu = true;
death.transform.position = gameObject.transform.position;
death.Play();
Destroy(gameObject);
}
}
}
what am i doing wrong?