Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

ComponentLookup<T0>.TryGetRefRO

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public bool TryGetRefRO(Entity entity, out RefRO`1 outRef);

Parameters

Parameter Description
entity The target entity
outRef The output reference will be stored here. See remarks.

Returns

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

Description

Attempts to get a safe reference to the component data, failing gracefully if the component isn't present.

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.