GetComponentData<T>()
Reads 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 T GetComponentData<T>() where T : unmanaged, IComponentData
Returns
Type | Description |
|---|---|
| T | A copy of the data component's value, or the default value for a component with no data. |
Remarks
Throws an if this Component is not a data component. Throws an if is not the type of this data component. Throws a if the data component no longer exists.
InvalidOperationExceptionArgumentExceptionTMissingReferenceExceptionA data component represented by a Component can only be used from the main thread. Calling this method from another thread throws a , even though the data component still exists. Back on the main thread the data component is unaffected and can be used again.
MissingReferenceException