Unity Odin (实现如图所示效果)(三)
![在这里插入图片描述](https://img-blog.csdnimg.cn/b6e398868bff405f980f1a35c17ea171.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAenp6c3NzMTIzMzMz,size_20,color_FFFFFF,t_70,g_se,x_16)
代码
using System;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
[Serializable]
public class Test2
{
[HorizontalGroup("base",Width = 150)]
[VerticalGroup("base/left")]
[LabelWidth(150)]
[HideLabel,Title("Enemy Name",Bold = false,HorizontalLine = false)]
public string enemyName;
[VerticalGroup("base/left")]
[PreviewField(ObjectFieldAlignment.Left,Height = 150)]
[HideLabel]
public Sprite sprite;
[VerticalGroup("base/right")]
[TextArea(5,5)]
public string info;
[HorizontalGroup("base/right/h")]
[VerticalGroup("base/right/h/left")]
[Range(0,10)]
[LabelWidth(30)]
public float s1;
[Range(0,10)]
[VerticalGroup("base/right/h/left")]
[LabelWidth(30)]
public float s2;
[Range(0,10)]
[VerticalGroup("base/right/h/right")]
[LabelWidth(30)]
public float s3;
[Range(0,10)]
[VerticalGroup("base/right/h/right")]
[LabelWidth(30)]
public float s4;
[MusicAssetList]
public List<AudioClip> allMusic;
}
using UnityEngine;
public class Test3 : MonoBehaviour
{
[PropertyOnly]
public Test2 test2;
}
using System;
using Sirenix.OdinInspector;
[IncludeMyAttributes]
[HideLabel]
[InlineProperty]
public class PropertyOnly : Attribute
{
}
using System;
using Sirenix.OdinInspector;
[IncludeMyAttributes]
[AssetList(Path = "Music")]
public class MusicAssetList : Attribute
{
}