赞
踩
- using UnityEditor;
- using UnityEngine;
- [CustomEditor(typeof(Test))]
- public class Tools:Editor
- {
- bool show = true;
- public override void OnInspectorGUI()
- {
-
- Test mc = (Test)target;
- base.OnInspectorGUI();
- show = EditorGUILayout.Toggle("show",show);
- if (show)
- {
- if (GUILayout.Button("我的按钮", GUILayout.Height(30)))
- {
- //按钮的功能写这里
- //mc.a = 50;
- }
- }
- else if(!show)
- {
- //不显示按钮
- }
- }
- }

- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Test : MonoBehaviour
- {
- public int a=10;
- public Vector3 pos, rot;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。