Odin Attributes 为Unity开发者提供了更多的自定义选项,使得开发过程更加高效和愉悦。通过使用这些特性,开发者可以创建更加专业和用户友好的编辑器界面,从而提升整个开发团队的工作效率。
Enable GUI 特性用于控制只有
get
的属性,在 Inspector 中是否置灰(不管置灰与否都不可编辑),不写则默认置灰。
using Sirenix.OdinInspector;
using UnityEngine;
public class EnableGUIExample : MonoBehaviour
{
[ShowInInspector]
public int GUIDisabledProperty { get { return 20; } }
[ShowInInspector, EnableGUI]
public int GUIEnabledProperty { get { return 10; } }
}