GameObjectEx.DestroyObjectWithAllParents C# (CSharp) Метод

DestroyObjectWithAllParents() публичный статический Метод

Destroies the object with all parents.
public static DestroyObjectWithAllParents ( Transform child ) : void
child Transform Child.
Результат void
    public static void DestroyObjectWithAllParents(Transform child)
    {
        Transform parent = child;
        while (parent.parent)
        {
            parent = parent.parent;
        }
        GameObject.Destroy(parent.gameObject);
    }