# CompanionComponent<T>

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

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IComponentData](/engine/7000.0/script-reference/unity/entities/icomponentdata.md), [IQueryTypeParameter](/engine/7000.0/script-reference/unity/entities/iquerytypeparameter.md)

```csharp
public struct CompanionComponent<T> : IComponentData, IQueryTypeParameter where T : Component
```

## Remarks

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

## Fields

| Value                                                                                              | Description                                                                           |
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [CompanionRef](/engine/7000.0/script-reference/unity/entities/companioncomponent1/companionref.md) | The reference to the UnityEngine.Component that this component exposes on the entity. |
