public static HashSet <Type> GetAllDataTypes() { var types = new HashSet <Type>(); // Get data types nominated by an attribute directly on the type declaration. var typeDecorations = AttributeUtility.EnumerateDecorations <ScriptableDataAttribute>( targets: EnumerateAllTypes(), filter: provider => provider is Type type && type.IsValueType); foreach (var decoration in typeDecorations) { types.Add(decoration.Target as Type); } // Get data types nominated by an assembly attribute. var assemblyDecorations = AttributeUtility.EnumerateDecorations <NominateScriptableDataAttribute>(GetAssemblies()); foreach (var decoration in assemblyDecorations) { var attribute = (NominateScriptableDataAttribute)decoration.CustomAttribute; if (attribute.TryGetIdentifiedType(out Type type) && type != null && type.IsValueType) { types.Add(type); } } return(types); }