文档

Unity Engine

Download Unity

Unity Engine

TryGetRefRW(Entity, out RefRW<T>)

Attempts to get a safe reference to the component data, failing gracefully if the component isn't present.
阅读时间1 分钟最后更新于 19 天前

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule

TryGetRefRW(Entity, RefRW<T>)

public bool TryGetRefRW(Entity entity, out RefRW<T> outRef)

Parameters

entity

The target entity

outRef

The output reference will be stored here. See remarks.

Returns

Type

Description

boolReturns true if component
T
exists on
entity
, or false if it does not.

Remarks

If
T
is a zero-size component,
outRef
will not contain a valid reference; zero-size components do not have an address in memory. However, this function will still return true or false depending on whether
entity
has component
T
.