docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method GetComponentInScene

    GetComponentInScene<T>(Scene)

    Retrieves the first component of the given type in a scene

    Declaration
    public static T GetComponentInScene<T>(Scene scene) where T : Component
    Parameters
    Type Name Description
    Scene scene

    The scene to search

    Returns
    Type Description
    T

    The first component found in the active scene, or null if none exists

    Type Parameters
    Name Description
    T

    The type of component to retrieve

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)