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

EntityQuery.TryGetSingletonRW

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 TryGetSingletonRW(out RefRW`1 value);

Parameters

Parameter Description
value The reference of the component

Returns

bool A reference to the singleton component.

Description

Gets a reference to the value of a singleton component, and returns whether or not a singleton component of the specified type matches inside the EntityQuery. Note that if querying a singleton component from a system-associated entity, the query must include either EntityQueryOptions.IncludeSystems or the SystemInstance component.

A singleton component is a component of which only one instance exists that satisfies this query.

Additional resources: EntityQuery.GetSingletonRW, EntityQuery.SetSingleton, EntityQuery.GetSingletonEntity, EntityQuery.GetSingletonBuffer, ComponentSystemBase.GetSingleton