modify
This commit is contained in:
parent
3127057602
commit
e557479cc1
@ -5,6 +5,20 @@ namespace UnityEngine
|
|||||||
{
|
{
|
||||||
public static class UnityEngageGameObjectExtension
|
public static class UnityEngageGameObjectExtension
|
||||||
{
|
{
|
||||||
|
public static void SafeDestroySelf(
|
||||||
|
this Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null) return;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if (!Application.isPlaying)
|
||||||
|
Object.DestroyImmediate(obj);
|
||||||
|
else
|
||||||
|
Object.Destroy(obj);
|
||||||
|
#else
|
||||||
|
Object.Destroy(obj);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
private static readonly List<Transform> s_CachedTransforms = new List<Transform>();
|
private static readonly List<Transform> s_CachedTransforms = new List<Transform>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -85,4 +99,4 @@ namespace UnityEngine
|
|||||||
s_CachedTransforms.Clear();
|
s_CachedTransforms.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user