/* public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { * var qualifiedName = property.FindPropertyRelative("assemblyQualifiedName"); * var types = GetTypes() ?? new List<SerializableType>(); * * types.Insert(0, null); * var type = string.IsNullOrEmpty(qualifiedName.stringValue) ? null : Type.GetType(qualifiedName.stringValue); * index = types.IndexOf(type); * int newIndex = EditorGUI.Popup(position, label, index < 0 ? 0 : index, types.Select(t => new GUIContent(t.Value?.FullName ?? NO_TYPE)).ToArray()); * if (newIndex != index && newIndex >= 0) { * qualifiedName.stringValue = types[newIndex].Value?.AssemblyQualifiedName; * index = newIndex; * } * } */ private List <SerializableType> GetTypes() { var filter = new TypeFilter(fieldInfo?.GetCustomAttributes <TypeFilterAttribute>(true)?.ToArray()); return(filter.CollectSerializableTypes(fieldInfo)); }
public static bool IsValid(this TypeFilter filter, TypeDefinition definition) { return(filter.IsValid(Type.GetType(definition.AssemblyQualifiedName()))); }
public TypeAnalysisData(FieldInfo field, TypeFilter filter) { this.field = field; this.filter = filter; }