docs.unity3d.com
    Show / Hide Table of Contents

    Method GetSharedComponentData

    GetSharedComponentData<T>(Entity)

    Gets a shared component from an entity.

    Declaration
    public T GetSharedComponentData<T>(Entity entity)
        where T : struct, ISharedComponentData
    Parameters
    Type Name Description
    Entity entity

    The entity.

    Returns
    Type Description
    T

    A copy of the shared component.

    Type Parameters
    Name Description
    T

    The type of shared component.

    GetSharedComponentData<T>(Int32)

    Gets a shared component by index.

    Declaration
    public T GetSharedComponentData<T>(int sharedComponentIndex)
        where T : struct, ISharedComponentData
    Parameters
    Type Name Description
    Int32 sharedComponentIndex

    The index of the shared component in the internal shared component list.

    Returns
    Type Description
    T

    A copy of the shared component.

    Type Parameters
    Name Description
    T

    The data type of the shared component.

    Remarks

    The ECS framework maintains an internal list of unique shared components. You can get the components in this list, along with their indices using GetAllUniqueSharedComponentData<T>(List<T>, List<Int32>). An index in the list is valid and points to the same shared component index as long as the shared component order version from GetSharedComponentOrderVersion<T>(T) remains the same.

    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