GetCompanion<T>(EntityManager, Entity)
Returns the UnityEngine.Component of type T referenced by the entity's companion component.
Read time 1 minuteLast updated a day ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.CoreModule
public static T GetCompanion<T>(this EntityManager entityManager, Entity entity) where T : Component
Parameters
The entity manager that stores entity.
The entity to read the companion component from.
Returns
Type | Description |
|---|---|
| T | The T component referenced by the entity's CompanionComponent\<T\>. |
Remarks
Resolving the reference is a managed call, so call this method from the main thread. Throws if entity has no CompanionComponent\<T\>.