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

Odin Inspector 系列教程 --- Property

作者: 忆中异 | 来源:发表于2021-11-26 16:01 被阅读0次

PropertySpace特性:与Unity的现有Space属性具有相同的功能,但可以应用于任何属性而不仅仅是字段
而且还可以控制与前后字段的间距

image
完整示例代码
using Sirenix.OdinInspector;
using UnityEngine;

public class PropertySpaceExample : MonoBehaviour
{
    [Space]
    public int unitySpace;

    [Space(5)]
    public int unitySpace1;
    [PropertySpace]
    public int OdinSpace2;

    [ShowInInspector, PropertySpace]
    public int Property { get; set; }

    // 还可以控制PropertySpace属性前后的间距。
    [PropertySpace(SpaceBefore = 30, SpaceAfter = 30)]
    public int BeforeAndAfter;
    [PropertySpace(SpaceBefore = 30, SpaceAfter = 30)]
    public int BeforeAndAfter1;
}


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

链接:https://www.jianshu.com/p/19d1675dc155

相关文章

网友评论

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

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