Documentation

Unity Engine

Download Unity

Unity Engine

SetComponentEnabled<T>(bool)

Enables or disables the enableable data component T, an IEnableableComponent, on the GameObject this Component is attached to.
Read time 1 minuteLast updated 6 hours ago

Definition

public void SetComponentEnabled<T>(bool value) where T : unmanaged, IEnableableComponent

Parameters

value

True to enable the data component, false to disable it.

Remarks

Throws an
ArgumentException
if the GameObject has been destroyed or doesn't have the data component.
Waits for the jobs that read or write
T
to complete. To avoid the wait, access
T
in a job through a
Unity.Entities.ComponentLookup
, or a
Unity.Entities.BufferLookup
for a Buffer. The job then runs after the jobs that read or write
T
, instead of the main thread waiting for them.