一.菜单栏MenuItem()

完整方法:[MenuItem (itemName : string, isValidateFunction : bool, priority : int)]
参数itemName :路径名
参数isValidateFunction:是否判断运行条件 默认为false。 true时,需要重新加一个判断条件的函数
参数priority :组ID ,默认为1000,数值越小越靠前,10个为一组,会用小横线隔开

快捷键
" %" 表示Ctrl cmd
" #" 表示shift
“ &” 表示alt
“ _字母” 表示单一按键
其他的一个键的支持情况: LEFT, RIGHT, UP, DOWN, F1 … F12, HOME, END, PGUP, PGDN

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class TestTool : MonoBehaviour
{
    [MenuItem("我是菜单栏的/我是第一级/我是第二个", true)]
    public static bool 我是第二个判断()
    {
        Debug.Log("我是第二个判断");
        return Selection.objects.Length >= 3;
    }

    [MenuItem("我是菜单栏的/我是第一级/我是第二个 _b", false, 1)]
    public static void 我是第二个()
    {
        Debug.Log("我是第二个"); 
    }

    [MenuItem("我是菜单栏的/我是第一级/我是第三个", false, 12)]
    public static void 我是第三个()
    
        Debug.Log("我是第三个");
    }
}

在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值