# UnregisterContext(IShortcutContext)

> Removes a IShortcutContext from the shortcut context list.

## Definition

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

```csharp
public static void UnregisterContext(IShortcutContext context)
```

### Parameters

**** (\[IShortcutContext]\(/engine/6000.5/script-reference/unityeditor/shortcutmanagement/ishortcutcontext)): The custom context to remove from the shortcut context list.

### Remarks

Additional Resources: [ShortcutManager.RegisterContext](/engine/6000.5/script-reference/unityeditor/shortcutmanagement/shortcutmanager/registercontext.md).

### Examples

```csharp
using UnityEditor;
using UnityEditor.ShortcutManagement;
using UnityEngine;

public class ShortcutContextSample : EditorWindow
{
    public class CustomShortcutContext : IShortcutContext
    {
        public bool active
        {
            get
            {
                if (!(focusedWindow is ShortcutContextSample view))
                    return false;

                return view.toggleValue;
            }
        }
    }

    [Shortcut("Custom Shortcut Context/Sample Shortcut", typeof(CustomShortcutContext), KeyCode.Mouse1)]
    static void SampleShortcut(ShortcutArguments args)
    {
        Debug.Log("The sample shortcut was called.");
    }

    bool m_ToggleValue = false;
    public bool toggleValue => m_ToggleValue;

    CustomShortcutContext m_ShortcutContext = new CustomShortcutContext();

    [MenuItem("Window/Custom Editor Window")]
    public static void ShowWindow()
    {
        ShortcutContextSample wnd = GetWindow<ShortcutContextSample>();
        wnd.titleContent = new GUIContent("Custom Editor Window");
    }

    void OnGUI()
    {
        var content = new GUIContent("Toggle", "Toggle to activate the shortcut context.");
        m_ToggleValue = EditorGUILayout.Toggle(content, m_ToggleValue);
    }

    private void OnEnable()
    {
        ShortcutManager.RegisterContext(m_ShortcutContext);
    }

    private void OnDisable()
    {
        ShortcutManager.UnregisterContext(m_ShortcutContext);
    }
}
```
