Odin-Inspector-系列教程—–DisableContextMenuAttribute

Disable Context Menu Attribute:可用于任何属性,并禁用该属性的上下文菜单。如果您不希望属性使用上下文菜单,请使用此选项。

using Sirenix.OdinInspector;
using UnityEngine;

public class DisableContextMenuAttributeExample : MonoBehaviour
{
    [InfoBox("禁用所有由Odin提供的右键上下文菜单。它不会禁用Unity的上下文菜单.", InfoMessageType.Warning)]
    [DisableContextMenu]
    public int[] NoRightClickList = new int[] { 2, 3, 5 };

    [DisableContextMenu(disableForMember: false, disableCollectionElements: true)]
    public int[] NoRightClickListOnListElements = new int[] { 7, 11 };

    [DisableContextMenu(disableForMember: true, disableCollectionElements: true)]
    public int[] DisableRightClickCompletely = new int[] { 13, 17 };

    [DisableContextMenu]
    public int NoRightClickField = 19;

    public int RightClickField = 19;
}

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

发表评论