# CreateCachedEditorWithContext

> Creates a cached editor using a context object.

## Definition

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

## CreateCachedEditorWithContext(Object, Object, Type, Editor)

Creates a cached editor using a context object.

```csharp
public static void CreateCachedEditorWithContext(Object targetObject, Object context, Type editorType, ref Editor previousEditor)
```

### Parameters

**** (\[Object]\(/engine/6000.7/script-reference/unityengine/object)): **** (\[Object]\(/engine/6000.7/script-reference/unityengine/object)): **** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): **** (\[Editor]\(/engine/6000.7/script-reference/unityeditor/editor)):&#x20;

### Remarks

This method is similar to [Editor.CreateCachedEditor](/engine/6000.7/script-reference/unityeditor/editor/createcachededitor.md) except that the [SerializedObject](/engine/6000.7/script-reference/unityeditor/serializedobject.md) is created with the context object passed as a parameter. This context object stores and retrieves the value for the ExposedReference types declared on the [SerializedObject](/engine/6000.7/script-reference/unityeditor/serializedobject.md).

## CreateCachedEditorWithContext(Object\[], Object, Type, Editor)

Creates a cached editor using a context object.

```csharp
public static void CreateCachedEditorWithContext(Object[] targetObjects, Object context, Type editorType, ref Editor previousEditor)
```

### Parameters

**** (\[Object\[]]\(/engine/6000.7/script-reference/unityengine/object)): **** (\[Object]\(/engine/6000.7/script-reference/unityengine/object)): **** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): **** (\[Editor]\(/engine/6000.7/script-reference/unityeditor/editor)):&#x20;

### Remarks

This method is similar to [Editor.CreateCachedEditor](/engine/6000.7/script-reference/unityeditor/editor/createcachededitor.md) except that the [SerializedObject](/engine/6000.7/script-reference/unityeditor/serializedobject.md) is created with the context object passed as a parameter. This context object stores and retrieves the value for the ExposedReference types declared on the [SerializedObject](/engine/6000.7/script-reference/unityeditor/serializedobject.md).
