/// <summary>
        /// Calls the proper Destroy method on an object based on if application is playing
        /// </summary>
        /// <param name="obj">Object to be destroyed</param>
        /// <param name="delay">How long to delay before destroying the object</param>
        /// <param name="withUndo">Whether to record undo for the destroy action</param>
        public static void Destroy(UnityObject obj, float delay = 0f, bool withUndo = false)
        {
            if (Application.isPlaying)
            {
                UnityObject.Destroy(obj, delay);
            }
#if UNITY_EDITOR
            else
            {
                if (Mathf.Approximately(delay, 0f))
                {
                    if (withUndo)
                    {
                        Undo.DestroyObjectImmediate(obj);
                    }
                    else
                    {
                        UnityObject.DestroyImmediate(obj);
                    }
                }
                else
                {
                    EditorMonoBehaviour.StartEditorCoroutine(DestroyInSeconds(obj, delay));
                }
            }
#endif
        }
 void Awake()
 {
     instance = this;
 }