Documentation

Unity Engine

Download Unity

Unity Engine

SetComponentData<T>(T)

Writes the value of the IComponentData that this Component refers to.
Read time 1 minuteLast updated 6 hours ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public void SetComponentData<T>(T value) where T : unmanaged, IComponentData

Parameters

value

T
The value to write. A component with no data ignores it.

Remarks

Throws an
InvalidOperationException
if this Component is not a data component, or if the World of the data component is in an exclusive entity transaction. Throws an
ArgumentException
if
T
is not the type of this data component. Throws a
MissingReferenceException
if the data component no longer exists.
A data component represented by a Component can only be used from the main thread. Calling this method from another thread throws a
MissingReferenceException
, even though the data component still exists. Back on the main thread the data component is unaffected and can be used again.