# DrawFoldoutInspector(Object, ref Editor)

> Draws the inspector GUI with a foldout header for target.

## Definition

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

## DrawFoldoutInspector(Object, Editor)

```csharp
public static void DrawFoldoutInspector(Object target, ref Editor editor)
```

### Parameters

**** (\[Object]\(/engine/6000.3/script-reference/unityengine/object)): The object to display the Inspector for.**** (\[Editor]\(/engine/6000.3/script-reference/unityeditor/editor)): The reference to a variable of type [Editor](/engine/6000.3/script-reference/unityeditor/editor.md).

### Remarks

Unity tracks the fold status for each different object type. Unity caches the created Editor object in the `editor` variable, eliminating the need to create it repeatedly. Make sure to destroy the Editor object using [Object.DestroyImmediate](/engine/6000.3/script-reference/unityengine/object/destroyimmediate.md) after you have finished using it.
