[MenuItem("Tools/Test Lock")]
static void Lock()
{
Type t = typeof(EditorWindow).Assembly.GetType("UnityEditor.InspectorWindow");
var window = EditorWindow.GetWindow(t);
bool state = (bool)t.GetProperty("isLocked").GetValue(window);
if (!state)
t.GetProperty("isLocked").SetValue(window, true);
}
代码控制 Inspector 视图的锁定 这个提供了一种解题思路!!!