# QueryStateObject(Type, int)

> Get an existing state object from a controlID.

## Definition

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

```csharp
public static object QueryStateObject(Type t, int controlID)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [Object](https://learn.microsoft.com/dotnet/api/system.object) |             |

### Remarks

This will return a recycled state object that is unique for controlID. If the state object has not been created by calling [GUIUtility.GetStateObject](/engine/6000.0/script-reference/unityengine/guiutility/getstateobject.md) then it cannot be accessed using [GUIUtility.QueryStateObject](/engine/6000.0/script-reference/unityengine/guiutility/querystateobject.md).  A call into [GUIUtility.QueryStateObject](/engine/6000.0/script-reference/unityengine/guiutility/querystateobject.md) with the state object not created is invalid.  A null may be returned, but is not guaranteed.  An exception may happen instead.

Additional Resources: [GUIUtility.GetStateObject](/engine/6000.0/script-reference/unityengine/guiutility/getstateobject.md).
