Class GameObjectExtensions | Anime Toolbox | 0.4.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class GameObjectExtensions

    Extension methods for GameObject class.

    Inheritance
    Object
    GameObjectExtensions
    Namespace: Unity.AnimeToolbox
    Syntax
    public static class GameObjectExtensions

    Methods

    DestroyChildrenImmediate(GameObject)

    Destroy all children of a GameObject, while allowing assets to be destroyed.

    Declaration
    public static void DestroyChildrenImmediate(this GameObject go)
    Parameters
    Type Name Description
    GameObject go

    The GameObject which children will be destroyed.

    DestroyChildrenImmediate(Transform)

    Destroy all children of a Transform, while allowing assets to be destroyed.

    Declaration
    public static void DestroyChildrenImmediate(this Transform t)
    Parameters
    Type Name Description
    Transform t

    The Transform which children will be destroyed.

    GetOrAddComponent<T>(GameObject)

    Returns the component of Type type. If one doesn't already exist on the GameObject it will be added.

    Declaration
    public static T GetOrAddComponent<T>(this GameObject gameObject)
        where T : Component
    Parameters
    Type Name Description
    GameObject gameObject

    The GameObject this Component is attached to.

    Returns
    Type Description
    T

    Component

    Type Parameters
    Name Description
    T

    The type of Component to return.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023