Documentation

Unity Engine


Unity Engine


IsComponentEnabled

Checks whether a given ComponentType is enabled on the specified Entity.
Read time 2 minutesLast updated a day ago

Definition

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

IsComponentEnabled<T>(Entity)

Checks whether a given ComponentType is enabled on the specified Entity.
public bool IsComponentEnabled<T>(Entity entity) where T : unmanaged, IEnableableComponent

Parameters

entity

The entity whose component should be checked.

Returns

Type

Description

boolTrue if the specified component is enabled, or false if it is disabled.

Remarks

An entity with a disabled component will not match an EntityQuery that requires that component, and will match a query that excludes that component.

IsComponentEnabled<T>(SystemHandle)

Checks whether a given ComponentType is enabled on the specified system using SystemHandle.
public bool IsComponentEnabled<T>(SystemHandle systemHandle) where T : unmanaged, IEnableableComponent

Parameters

systemHandle

The system whose component should be checked.

Returns

Type

Description

boolTrue if the specified component is enabled, or false if it is disabled.

Remarks

IsComponentEnabled(Entity, ComponentType)

Checks whether a given ComponentType is enabled on the specified Entity.
public bool IsComponentEnabled(Entity entity, ComponentType componentType)

Parameters

entity

The entity whose component should be checked.

componentType

The component type to enable or disable. This type must implement the IEnableableComponent interface.

Returns

Type

Description

boolTrue if the specified component is enabled, or false if it is disabled.

Remarks

An entity with a disabled component will not match an EntityQuery that requires that component, and will match a query that excludes that component.