如果不知道图片在表达些什么,请仔细看Inspector右上角的小锁头。。。。
[MenuItem("Custom/InspectorFlipLocked &L")]
static void MenuItem_InspectorFlipLocked()
{
System.Type typeInspector = typeof(EditorWindow).Assembly.GetType("UnityEditor.InspectorWindow");
EditorWindow w = EditorWindow.focusedWindow;
if(!typeInspector.IsInstanceOfType(w))
{
w = null;
Object[] objs = Resources.FindObjectsOfTypeAll(typeInspector);
if(objs.Length > 0) w = objs[0] as EditorWindow;
}
if(w!=null)
{
ActiveEditorTracker tracker = typeInspector.InvokeMember("GetTracker", BindingFlags.InvokeMethod, null, w, null) as ActiveEditorTracker;
tracker.isLocked = !tracker.isLocked;
Debug.Log("Inspector at " + w.position + " is " + (tracker.isLocked?"LOCKED":"UNLOCKED"));
w.Repaint();
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。