Asset List Attribute

AssetLists is used on lists and arrays and single elements of unity types, and replaces the default list drawer with a list of all possible assets with the specified filter. Use this to both filter and include or exclude assets from a list or an array, without navigating the project window.

[AssetList]
[PreviewField(70, ObjectFieldAlignment.Center)]
public Texture2D SingleObject;

[AssetList(Path = "/Plugins/Sirenix/")]
public List<ScriptableObject> AssetList;

[FoldoutGroup("Filtered Odin ScriptableObjects", expanded: false)]
[AssetList(Path = "Plugins/Sirenix/")]
public ScriptableObject Object;

[AssetList(AutoPopulate = true, Path = "Plugins/Sirenix/")]
[FoldoutGroup("Filtered Odin ScriptableObjects", expanded: false)]
public List<ScriptableObject> AutoPopulatedWhenInspected;

[AssetList(LayerNames = "MyLayerName")]
[FoldoutGroup("Filtered AssetLists examples")]
public GameObject[] AllPrefabsWithLayerName;

[AssetList(AssetNamePrefix = "Rock")]
[FoldoutGroup("Filtered AssetLists examples")]
public List<GameObject> PrefabsStartingWithRock;

[FoldoutGroup("Filtered AssetLists examples")]
[AssetList(Tags = "MyTagA, MyTabB", Path = "/Plugins/Sirenix/")]
public List<GameObject> GameObjectsWithTag;

[FoldoutGroup("Filtered AssetLists examples")]
[AssetList(CustomFilterMethod = "HasRigidbodyComponent")]
public List<GameObject> MyRigidbodyPrefabs;

private bool HasRigidbodyComponent(GameObject obj)
{
    return obj.GetComponent<Rigidbody>() != null;
}