Custom Context Menu Attribute:可用于任何属性,并将自定义选项添加到属性的上下文菜单。当您要将自定义操作添加到属性的上下文菜单时,请使用此选项。
![7643202-1b6aad81462f1a49.gif](https://i-blog.csdnimg.cn/blog_migrate/54e958a4cce3ee05a4e5917383403018.gif)
using Sirenix.OdinInspector;
using UnityEngine;
public class CustomContextMenuAttributeExample : MonoBehaviour
{
[InfoBox("右键属性可在菜单中出发指定的函数.")]
[CustomContextMenu("Say Hello/菜鸟海澜", "SayHelloFunction")]
public int MyProperty;
private void SayHelloFunction()
{
Debug.Log("Hello 菜鸟海澜");
}
}