Documentation

Unity Engine

Unity Engine

this[]

Gets the IComponentData instance of type T for the specified entity.
Read time 1 minuteLast updated 5 days ago

Definition

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

this[Entity]

Gets the IComponentData instance of type T for the specified entity.
public T this[Entity entity] { get; set; }

Parameters

entity

The entity.

Returns

Type

Description

TAn IComponentData type.

Remarks

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.

this[SystemHandle]

Gets the IComponentData instance of type T for the specified system's associated entity.
public T this[SystemHandle system] { get; set; }

Parameters

The system handle.

Returns

Type

Description

TAn IComponentData type.

Remarks

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.