docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetComponentData

    GetComponentData<T>(EntityManager, Entity)

    Gets the value of a component for an entity.

    Declaration
    public static T GetComponentData<T>(this EntityManager manager, Entity entity) where T : class, IComponentData, new()
    Parameters
    Type Name Description
    EntityManager manager

    This entity manager.

    Entity entity

    The entity.

    Returns
    Type Description
    T

    A struct of type T containing the component value.

    Type Parameters
    Name Description
    T

    The type of component to retrieve.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the component type has no fields.

    GetComponentData<T>(EntityManager, SystemHandle)

    Gets the value of a component for an entity associated with a system.

    Declaration
    public static T GetComponentData<T>(this EntityManager manager, SystemHandle system) where T : class, IComponentData, new()
    Parameters
    Type Name Description
    EntityManager manager

    This entity manager.

    SystemHandle system

    The system handle.

    Returns
    Type Description
    T

    A struct of type T containing the component value.

    Type Parameters
    Name Description
    T

    The type of component to retrieve.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the component type has no fields.

    InvalidOperationException

    Thrown if the system isn't from thie world.

    In This Article
    • GetComponentData<T>(EntityManager, Entity)
    • GetComponentData<T>(EntityManager, SystemHandle)
    Back to top
    Copyright © 2025 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)