1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 17:26:02 +08:00

Support inherited attributes (#116)

This commit is contained in:
Sergi Tortosa Ortiz-Villajos 2019-02-19 22:50:45 +01:00 committed by Thor Brigsted
parent 5acb7e4ba8
commit 43038cfcc1

View File

@ -25,7 +25,7 @@ namespace XNodeEditor {
public static bool GetAttrib<T>(object[] attribs, out T attribOut) where T : Attribute {
for (int i = 0; i < attribs.Length; i++) {
if (attribs[i].GetType() == typeof(T)) {
if (attribs[i] is T){
attribOut = attribs[i] as T;
return true;
}
@ -43,7 +43,7 @@ namespace XNodeEditor {
attribOut = null;
return false;
}
object[] attribs = field.GetCustomAttributes(typeof(T), false);
object[] attribs = field.GetCustomAttributes(typeof(T), true);
return GetAttrib(attribs, out attribOut);
}