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

ComponentLookup<T0>.this[Entity]

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

public T this[Entity];

Parameters

Parameter Description
entity The entity.

Returns

T An IComponentData type.

Description

Gets the IComponentData instance of type T for the specified entity.

Normally, you cannot write to components accessed using a ComponentLookup instance in a parallel Job. This restriction is in place because multiple threads could write to the same component, leading to a race condition and nondeterministic results. However, when you are certain that your algorithm cannot write to the same component from different threads, you can manually disable this safety check by putting the [NativeDisableParallelForRestriction] attribute on the ComponentLookup field in the Job.

[NativeDisableParallelForRestrictionAttribute]: https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeDisableParallelForRestrictionAttribute.html


public T this[SystemHandle];

Parameters

Parameter Description
system The system handle.

Returns

T An IComponentData type.

Description

Gets the IComponentData instance of type T for the specified system's associated entity.

Normally, you cannot write to components accessed using a ComponentDataFromEntity instance in a parallel Job. This restriction is in place because multiple threads could write to the same component, leading to a race condition and nondeterministic results. However, when you are certain that your algorithm cannot write to the same component from different threads, you can manually disable this safety check by putting the [NativeDisableParallelForRestriction] attribute on the ComponentDataFromEntity field in the Job.

[NativeDisableParallelForRestrictionAttribute]: https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeDisableParallelForRestrictionAttribute.html