Files
Continentis/Assets/Scripts/SLSUtilities/General/TransformExtension.cs

24 lines
637 B
C#
Raw Normal View History

2025-10-03 00:02:43 -04:00
using Lean.Pool;
using UnityEngine;
2025-10-23 00:49:44 -04:00
namespace SLSFramework.General
2025-10-03 00:02:43 -04:00
{
public static class TransformExtension
{
public static void DestroyAllChildren(this Transform transform)
{
for (int i = transform.childCount - 1; i >= 0; i--)
{
Object.Destroy(transform.GetChild(i).gameObject);
}
}
public static void DespawnAllChildren(this Transform transform)
{
for (int i = transform.childCount - 1; i >= 0; i--)
{
LeanPool.Despawn(transform.GetChild(i).gameObject);
}
}
}
}