21 lines
569 B
C#
21 lines
569 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public static class Extension
|
|
{
|
|
public static void RemoveAllChildren(this Transform content)
|
|
{
|
|
for (int i = content.childCount - 1; i >= 0; i--)
|
|
{
|
|
GameObject.Destroy(content.GetChild(i).gameObject);
|
|
}
|
|
}
|
|
public static void RemoveAllChildrenImmediate(this Transform content)
|
|
{
|
|
for (int i = content.childCount - 1; i >= 0; i--)
|
|
{
|
|
GameObject.DestroyImmediate(content.GetChild(i).gameObject);
|
|
}
|
|
}
|
|
} |