Documentation

Unity Engine


Unity Engine


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

entityManager

The entity manager that stores entity.

entity

The entity to read the companion component from.

Returns

Type

Description

TThe 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\>.