# ToObject

> Returns any valid Unity Object held by the search item.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.5/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## ToObject()

Returns any valid Unity Object held by the search item.

```csharp
public Object ToObject()
```

### Returns

| Type                                                            | Description                                      |
| --------------------------------------------------------------- | ------------------------------------------------ |
| [Object](/engine/6000.5/script-reference/unityengine/object.md) | Returns a Unity Object or null if there is none. |

### Remarks

See [SearchProvider.toObject](/engine/6000.5/script-reference/unityeditor/search/searchprovider/toobject.md) more information on what it means to convert a SearchItem to a [Object](/engine/6000.5/script-reference/unityengine/object.md).

## ToObject(Type)

Returns any valid Unity Object held by the search item.

```csharp
public Object ToObject(Type type)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): Used to validate if the object is assignable to Type.

### Returns

| Type                                                            | Description                                      |
| --------------------------------------------------------------- | ------------------------------------------------ |
| [Object](/engine/6000.5/script-reference/unityengine/object.md) | Returns a Unity Object or null if there is none. |

### Remarks

See [SearchProvider.toObject](/engine/6000.5/script-reference/unityeditor/search/searchprovider/toobject.md) more information on what it means to convert a SearchItem to a [Object](/engine/6000.5/script-reference/unityengine/object.md).

## ToObject\<T>()

Returns any valid Unity Object held by the search item.

```csharp
public T ToObject<T>() where T : Object
```

### Returns

| Type | Description                                        |
| ---- | -------------------------------------------------- |
| T    | Used to validate if the object is assignable to T. |
