docs.unity.cn
    Show / Hide Table of Contents

    Class ComponentUtils<T>

    Special utility class for getting components in the editor without allocations

    Inheritance
    Object
    ComponentUtils<T>
    Namespace: Unity.XRTools.Utils
    Syntax
    public static class ComponentUtils<T> : object
    Type Parameters
    Name Description
    T

    The type of component for which to be searched

    Methods

    GetComponent(GameObject)

    Get a single component of type T using the non-allocating GetComponents API

    Declaration
    public static T GetComponent(GameObject gameObject)
    Parameters
    Type Name Description
    GameObject gameObject

    The GameObject from which to get the component

    Returns
    Type Description
    T

    The component, if one exists

    GetComponentInChildren(GameObject)

    Get a single component of type T using the non-allocating GetComponentsInChildren API

    Declaration
    public static T GetComponentInChildren(GameObject gameObject)
    Parameters
    Type Name Description
    GameObject gameObject

    The GameObject from which to get the component

    Returns
    Type Description
    T

    The component, if one exists

    Back to top Copyright © 2021 Unity Technologies
    Generated by DocFX
    on Thursday, December 2, 2021
    Terms of use