美文网首页
Odin Inspector 系列教程 --- Custom C

Odin Inspector 系列教程 --- Custom C

作者: su9257_海澜 | 来源:发表于2019-10-09 09:57 被阅读0次

Custom Context Menu Attribute:可用于任何属性,并将自定义选项添加到属性的上下文菜单。当您要将自定义操作添加到属性的上下文菜单时,请使用此选项。

using Sirenix.OdinInspector;
using UnityEngine;

public class CustomContextMenuAttributeExample : MonoBehaviour
{
    [InfoBox("右键属性可在菜单中出发指定的函数.")]
    [CustomContextMenu("Say Hello/菜鸟海澜", "SayHelloFunction")]
    public int MyProperty;

    private void SayHelloFunction()
    {
        Debug.Log("Hello 菜鸟海澜");
    }
}

更多教程内容详见:革命性Unity 编辑器扩展工具 --- Odin Inspector 系列教程

相关文章

网友评论

      本文标题:Odin Inspector 系列教程 --- Custom C

      本文链接:https://www.haomeiwen.com/subject/lpdbpctx.html