using System;
using System.Reflection;
using UnityEngine;
public class SHY : Attribute
{
}
[SHY]
public class SHYTest
{
public int test = 10;
}
public class TestAttribute : MonoBehaviour
{
void Start()
{
var types = Assembly.GetCallingAssembly().GetTypes();
foreach (var item in types)
{
var attribute = item.GetCustomAttribute(typeof(SHY));
if (attribute != null)
{
Debug.LogError(item.Name);
FieldInfo[] fields = item.GetFields();
foreach (var field in fields)
{
Debug.LogError(field.Name);
}
}
}
}
}