///Show an arbitrary field type editor. Passing a FieldInfo will also check for attributes. public static object ReflectedFieldInspector(GUIContent content, object value, Type t, FieldInfo field = null, object context = null, object[] attributes = null) { if (t == null) { GUILayout.Label("NO TYPE PROVIDED!"); return(value); } ///Use drawers var drawerAttributes = attributes != null?attributes.OfType <DrawerAttribute>().OrderBy(a => a.priority).ToArray() : null; var objectDrawer = DrawerFactory.GetObjectDrawer(t); return(objectDrawer.DrawGUI(content, value, field, context, drawerAttributes)); }
///Show an arbitrary field type editor. Passing a FieldInfo will also check for attributes. public static object ReflectedFieldInspector(GUIContent content, object value, Type t, FieldInfo field = null, object context = null, object[] attributes = null){ if (t == null){ GUILayout.Label("NO TYPE PROVIDED!"); return value; } ///Use drawers if (field != null && attributes != null){ var drawerAttributes = attributes.OfType<DrawerAttribute>().OrderBy(a => a.priority).ToArray(); var drawer = DrawerFactory.GetObjectDrawer(t); return drawer.DrawGUI(content, value, field, context, drawerAttributes); } return DrawEditorFieldDirect(content, value, t, field, context, attributes); }