DRHPS/code-csharp/en_US/INT_DestroyComponent.cs
2025-04-08 11:31:35 +08:00

28 lines
725 B
C#

using UnityEngine;
public class INT_DestroyComponent : MonoBehaviour
{
public Component[] ComponentsToDestroy;
public bool HasGameObjects;
public GameObject[] GameObjectsToDestroy;
public void RUN()
{
Component[] componentsToDestroy = ComponentsToDestroy;
for (int i = 0; i < componentsToDestroy.Length; i++)
{
Object.Destroy(componentsToDestroy[i]);
}
if (HasGameObjects)
{
GameObject[] gameObjectsToDestroy = GameObjectsToDestroy;
for (int i = 0; i < gameObjectsToDestroy.Length; i++)
{
Object.Destroy(gameObjectsToDestroy[i]);
}
}
}
}