文档

Unity Engine

Download Unity

Unity Engine

AddComponentData<T>(Entity, T)

Adds a component to an entity and sets its value.
阅读时间1 分钟最后更新于 1 天前

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public static bool AddComponentData<T>(Entity entity, T componentData) where T : unmanaged, IComponentData

Parameters

entity

The entity.

componentData

T
The value.

Returns

Type

Description

boolFalse if the entity already had the component, in which case only its value is set.

Remarks

This is a structural change.