# GetStateObject(Type, int)

> Get a state object from a controlID.

## Definition

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

```csharp
public static object GetStateObject(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 there is no state object then a new one will be created and hooked up to the `controlID`.

On the first call into [GUIUtility.GetStateObject](/engine/6000.6/script-reference/unityengine/guiutility/getstateobject.md) a new state object will be created. The `controlID` uniquely refers to this object.  On subsequent calls the stored object will be returned.

Additional Resources: [GUIUtility.QueryStateObject](/engine/6000.6/script-reference/unityengine/guiutility/querystateobject.md).
