---
title: GetComponentData<T>()
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/component/getcomponentdata
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/component/getcomponentdata.md
last_updated: 2026-11-24
generated_at: 2026-11-24T17:38:41.175Z
locale: en-us
---

# GetComponentData<T>()

> Reads the value of the IComponentData that this Component refers to.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/7000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
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 `InvalidOperationException` if this Component is not a data component. 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.
