Documentation

Unity Engine

Download Unity

Unity Engine

AddComponent

Adds a component to an entity.
Read time 1 minuteLast updated a day ago

Definition

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

AddComponent<T>(Entity)

Adds a component to an entity.
public static bool AddComponent<T>(Entity entity)

Parameters

entity

The entity.

Returns

Type

Description

boolFalse if the entity already had the component.

Remarks

This is a structural change.

AddComponent(Entity, ComponentType)

Adds a component to an entity.
public static bool AddComponent(Entity entity, ComponentType componentType)

Parameters

entity

The entity.

componentType

The component type.

Returns

Type

Description

boolFalse if the entity already had the component.

Remarks

This is a structural change.