Unity-可分组折叠的Editor
- 🥗功能介绍
- 🍭用法
🥗功能介绍
在序列化的字段上标记特性:[FoldoutGroup(“xxx”)],inspector上就会被分组折叠显示。
(没有被指定的字段自动放到Default组中)
传送门🌈
🍭用法
1.Editor文件夹中新建一个xxxEditor,继承FoldoutGroupEditor
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace ZYF
{[CustomEditor(typeof(FoldoutGroupDemo))]public class FoldoutGroupDemoEditor : FoldoutGroupEditor{}}
2.在组件xxx中对字段进行分组特性标记:[FoldoutGroup(“xxx”)]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace ZYF
{public class FoldoutGroupDemo : MonoBehaviour{const string Group_String = "String";[SerializeField, FoldoutGroup(Group_String)]private string test_string;[FoldoutGroup(Group_String)]public string test_string2;}}