大修
This commit is contained in:
24
Assets/Scripts/SLSUtilities/General/TransformExtension.cs
Normal file
24
Assets/Scripts/SLSUtilities/General/TransformExtension.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SLSUtilities.General
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user