给方法打自定义标签再反射获取
1.自定义特性类
using System; using System.Collections; using System.Collections.Generic; /// <summary> /// 自定义新特性 /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class CustomA : Attribute { }
2.获取
using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using UnityEngine; public class MyTest : MonoBehaviour { // Use this for initialization void Start () { //反射自己这类 Type t = GetType(); //