GameObjectExtensions.DestroyAllChildren

Extension Method in GameObjectExtensions

Declaration

public static void DestroyAllChildren(this GameObject gameObject, bool immediate = false, bool allowDestroyingAssets = false)

Description

Destroys all children game objects.

Parameters

gameObjectThe game object to destroy all children of.
immediateDestroys the game objects immediately (not recommended).
allowDestroyingAssetsAllows project assets to be destroyed (not recommended).

Overload

Declaration

public static void DestroyAllChildren(this GameObject gameObject, float delay)

Description

Destroys all children game objects after a delay.

Parameters

gameObjectThe game object to destroy all children of.
delayThe delay before destroying the game objects.