当前位置: 首页> 房产> 市场 > Unity-可分组折叠的Editor

Unity-可分组折叠的Editor

时间:2025/7/16 15:29:24来源:https://blog.csdn.net/qq_26318597/article/details/141527898 浏览次数:0次

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;}}
关键字:Unity-可分组折叠的Editor

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: