Created
April 17, 2018 19:14
-
-
Save karl-/833efe87eb862fcb047e9d6c00442b8c to your computer and use it in GitHub Desktop.
Lock and unlock the current GameObject selection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
static class LockObjects | |
{ | |
[MenuItem("Edit/Lock Selection &l")] | |
static void LockSelected() | |
{ | |
foreach (var o in Selection.gameObjects) | |
o.hideFlags = o.hideFlags | HideFlags.NotEditable; | |
} | |
[MenuItem("Edit/Unlock Selection &#l")] | |
static void UnlockSelected() | |
{ | |
foreach (var o in Selection.gameObjects) | |
o.hideFlags = o.hideFlags & (~HideFlags.NotEditable); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment