using System.Collections; using System.Collections.Generic; using UnityEngine; // Die when the animation is complete. public class EffectController : MonoBehaviour { public bool diesByAnimation = true; public float manualDeathTime = 1.0f; public void AnimationDie() { Destroy(gameObject); } private void Awake() { if (!diesByAnimation) { Invoke("AnimationDie", manualDeathTime); } } }