docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method TryGetTransform

    TryGetTransform(Entity, out TransformRef)

    Retrieves the transform components associated with the specified Entity, if it exists. The return value indicates whether the component was successfully retrieved.

    Declaration
    public bool TryGetTransform(Entity entity, out TransformRef transform)
    Parameters
    Type Name Description
    Entity entity

    The entity.

    TransformRef transform

    The transform component of type T for the given entity, if it exists.

    Returns
    Type Description
    bool

    True if the entity has a TransformRef component, and false if it does not. Also returns false if the Entity instance refers to an entity that has been destroyed (or never existed).

    TryGetTransform(Entity, out TransformRef, out bool)

    Retrieves the transform components associated with the specified Entity, if it exists. The return value indicates whether the component was successfully retrieved.

    Declaration
    public bool TryGetTransform(Entity entity, out TransformRef transform, out bool entityExists)
    Parameters
    Type Name Description
    Entity entity

    The entity.

    TransformRef transform

    The transform component of type T for the given entity, if it exists.

    bool entityExists

    Denotes whether the given entity exists. Use to distinguish entity non-existence from TransformRef non-existence.

    Returns
    Type Description
    bool

    True if the entity has a TransformRef component, and false if it does not. Also returns false if the Entity instance refers to an entity that has been destroyed (or never existed).

    In This Article
    Back to top
    Copyright © 2026 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)