Advertisement
Arzola

InspectorMethodAttribute.cs

Jan 19th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Reflection;
  4.  
  5. public class InspectorMethodAttribute : PropertyAttribute
  6. {
  7.     #region Public Variables
  8.  
  9.  
  10.     public string methodName;
  11.     public string buttonName;
  12.     public bool useValue;
  13.     public BindingFlags flags;
  14.  
  15.  
  16.     #endregion Public Variables
  17.  
  18.  
  19.     #region Constructors
  20.  
  21.  
  22.     public InspectorMethodAttribute(string methodName, string buttonName, bool useValue, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance)
  23.     {
  24.         this.methodName = methodName;
  25.         this.buttonName = buttonName;
  26.         this.useValue = useValue;
  27.         this.flags = flags;
  28.     }
  29.  
  30.     public InspectorMethodAttribute(string methodName, bool useParameterBelow, BindingFlags flags)
  31.         : this(methodName, methodName, useParameterBelow, flags)
  32.     {
  33.     }
  34.  
  35.     public InspectorMethodAttribute(string methodName, bool useParameterBelow)
  36.         : this(methodName, methodName, useParameterBelow)
  37.     {
  38.     }
  39.  
  40.     public InspectorMethodAttribute(string methodName, string buttonName, BindingFlags flags)
  41.         : this(methodName, buttonName, false, flags)
  42.     {
  43.     }
  44.  
  45.     public InspectorMethodAttribute(string methodName, string buttonName)
  46.         : this(methodName, buttonName, false)
  47.     {
  48.     }
  49.  
  50.     public InspectorMethodAttribute(string methodName, BindingFlags flags)
  51.         : this(methodName, methodName, false, flags)
  52.     {
  53.     }
  54.  
  55.     public InspectorMethodAttribute(string methodName)
  56.         : this(methodName, methodName, false)
  57.     {
  58.     }
  59.  
  60.  
  61.     #endregion Constructors
  62.    
  63. }//End of class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement