Skip to content

Instantly share code, notes, and snippets.

@SiarheiPilat
Last active March 10, 2022 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiarheiPilat/b1469fba1b4f5757b10c083e88dbedb2 to your computer and use it in GitHub Desktop.
Save SiarheiPilat/b1469fba1b4f5757b10c083e88dbedb2 to your computer and use it in GitHub Desktop.
Lets user lock the Inspector window using keyboard shortcut. Note: Does not work for multiple inspector windows!
// ----------------------------------------------------------------------------
// Author: Siarhei Pilat
// Site: https://www.suasor-ab.com/
// This gist: https://gist.github.com/SiarheiPilat/b1469fba1b4f5757b10c083e88dbedb2
// Updated: 24 Feb 2021
// ----------------------------------------------------------------------------
using UnityEditor;
/// <summary>
/// Locks the inspector window with a shortcut. Works for a single inspector window. Need to restart the editor for it to work!
/// </summary>
static class InspectorLockShortcut
{
[MenuItem("Tools/Toggle Inspector lock %l")]
static void ToggleInspectorLock()
{
ActiveEditorTracker.sharedTracker.isLocked = !ActiveEditorTracker.sharedTracker.isLocked;
ActiveEditorTracker.sharedTracker.ForceRebuild();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment