public static bool GetAttrib <T>(Type classType, string fieldName, out T attribOut) where T : Attribute { // If we can't find field in the first run, it's probably a private field in a base class. FieldInfo field = NodeEditorWindow.GetFieldInfo(classType, fieldName); // This shouldn't happen. Ever. if (field == null) { Debug.LogWarning("Field " + fieldName + " couldnt be found"); attribOut = null; return(false); } object[] attribs = field.GetCustomAttributes(typeof(T), true); return(GetAttrib(attribs, out attribOut)); }
private static System.Type GetType(SerializedProperty property) { System.Type parentType = property.serializedObject.targetObject.GetType(); System.Reflection.FieldInfo fi = NodeEditorWindow.GetFieldInfo(parentType, property.name); return(fi.FieldType); }