This repository has been archived on 2025-09-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
XericLibrary-OLD/Runtime/CustomDrawer/GroupAttribute.cs
LiRuoChen a658cc424b 添加了更多的材质函数,部分与引擎新特性重合,这是为了能够脱离引擎在多个版本中更具可移植性。
添加了多种对程序流程控制与保全的脚本,而且现在可以更快速的构建一个具有线性关系的协程了。
  添加了一个支持多种模式的单维梯度控制器,类似unity的颜色梯度类型。
  添加了一个用于看向某个物体的旋转控制器。
  添加了一个加载宏。
  完善了批处理脚本流程。
2023-11-23 11:10:40 +08:00

55 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
namespace XericLibrary.Runtime.CustomDrawer
{
public class GroupAttribute : PropertyAttribute
{
public string group;
public GroupAttribute(string groupName)
{
group = groupName;
}
}
/// <summary>
/// ʹÓ÷Ö×鹦ÄܵÄʾÀý
/// </summary>
//[CustomEditor(typeof(GroupAttribute))]
public class GroupExampleEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
//ShowGroupInspector(target);
}
public static void ShowGroupInspector(Editor editor, object target)
{
// Iterate through the fields
foreach(var field in target.GetType().GetFields())
{
var groupAttribute = field.GetCustomAttribute<GroupAttribute>();
if(groupAttribute != null)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(groupAttribute.group, EditorStyles.boldLabel);
}
EditorGUILayout.PropertyField(editor.serializedObject.FindProperty(field.Name), true);
}
editor.serializedObject.ApplyModifiedProperties();
}
}
}