# GetFirstOfType<T>()

> Walks up the hierarchy, starting from this element, and returns the first VisualElement of this type

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.3/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public T GetFirstOfType<T>() where T : class
```

### Returns

| Type | Description |
| ---- | ----------- |
| T    |             |
