DestroyOnDisable.cs 236 B

1234567891011
  1. using UnityEngine;
  2. using System.Collections;
  3. //Useful when hiding UI, and want to delete any created items such as challenge result items
  4. public class DestroyOnDisable : MonoBehaviour
  5. {
  6. void OnDisable()
  7. {
  8. Destroy(gameObject);
  9. }
  10. }