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.

namespace Sirenix.OdinInspector
[AttributeUsageAttribute((AttributeTargets)384, AllowMultiple = False, Inherited = True)]
public sealed class AssetListAttribute : Attribute


Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector


Definition Description

Initializes a new instance of the AssetListAttribute class.


Return Type Definition Description
string AssetNamePrefix

Filter the asset list to only include assets which name begins with.

bool AutoPopulate

If true, all assets found and displayed by the asset list, will autoamatically be added to the list when inspected.

string CustomFilterMethod

Filter the asset list to only include assets for which the given filter method returns true.

string LayerNames

Filter the asset list to only include assets with a specified layer.

string Path

Filter the asset list to only include assets which is located at the specified path.

string Tags

Comma seperated list of tags to filter the asset list.


The following example will display an asset list of all prefabs located in the project window.

public class AssetListExamples : MonoBehaviour
    [InfoBox("The AssetList attribute work on both lists of UnityEngine.Object types and UnityEngine.Object types, but have different behaviour.")]
    public GameObject Prefab;

    public List<PlaceableObject> PlaceableObjects;

    [AssetList(Path = "Plugins/Sirenix/")]
    public UnityEngine.Object Object;

    [AssetList(AutoPopulate = true)]
    public List<PlaceableObject> PlaceableObjectsAutoPopulated;

    [AssetList(LayerNames = "MyLayerName")]
    public GameObject[] AllPrefabsWithLayerName;

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

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

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

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

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

    [InfoBox("Use a method as a custom filter for the asset list.")]
    [AssetList(CustomFilterMethod = "HasRigidbodyComponent")]
    public List<GameObject> MyRigidbodyPrefabs;

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