docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct CompanionComponent<T>

    An unmanaged component that references a UnityEngine.Component attached to an entity.

    Implements
    IComponentData
    IQueryTypeParameter
    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    public struct CompanionComponent<T> : IComponentData, IQueryTypeParameter where T : Component
    Type Parameters
    Name Description
    T
    Remarks

    Register each type you use with RegisterGenericComponentTypeAttribute, for example [assembly: RegisterGenericComponentType(typeof(CompanionComponent<Light>))].

    Fields

    Name Description
    CompanionRef

    The reference to the UnityEngine.Component that this component exposes on the entity.

    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)