using UnityEngine; using System.Collections; //Useful when hiding UI, and want to delete any created items such as challenge result items public class DestroyOnDisable : MonoBehaviour { void OnDisable() { Destroy(gameObject); } }