文档

Unity Engine

Download Unity

Unity Engine

GetCompanion<T>(EntityManager, Entity)

Returns the UnityEngine.Component of type T referenced by the entity's companion component.
阅读时间1 分钟最后更新于 19 天前

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