This commit is contained in:
陈思海 2025-04-11 19:57:23 +08:00
parent 3127057602
commit e557479cc1

View File

@ -5,6 +5,20 @@ namespace UnityEngine
{
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>();
/// <summary>