//重写OnInspectorGUI类(刷新Inspector面板) public override void OnInspectorGUI() { //继承基类方法 base.OnInspectorGUI(); //获取要执行方法的类 TestScene targetScript = (TestScene)target; //绘制Button if (GUILayout.Button("My Func")) { //执行方法 targetScript.ChangeScene(); } }