Version 3.3.1.2

Odin has a dedicated attribute overview with examples

AssetSelectorAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[Conditional("UNITY_EDITOR")]
public class AssetSelectorAttribute : Attribute, _Attribute
The AssetSelector attribute can be used on all Unity types and will prepend a small button next to the object field that when clicked, will present the user with a dropdown of assets to select from which can be customized from the attribute.
Inheritance
  • System.Object
  • System.Attribute
  • AssetSelectorAttribute

Constructors

AssetSelectorAttribute()
public AssetSelectorAttribute()

Fields

DisableListAddButtonBehaviour
False by default.
public bool DisableListAddButtonBehaviour
DrawDropdownForListElements
True by default. If the ValueDropdown attribute is applied to a list, then disabling this, will render all child elements normally without using the ValueDropdown. The ValueDropdown will still show up when you click the add button on the list drawer, unless DisableListAddButtonBehaviour is true.
public bool DrawDropdownForListElements
DropdownHeight
Gets or sets the height of the dropdown. Default is zero.
public int DropdownHeight
DropdownTitle
Gets or sets the title for the dropdown. Null by default.
public string DropdownTitle
DropdownWidth
Gets or sets the width of the dropdown. Default is zero.
public int DropdownWidth
ExcludeExistingValuesInList
If the ValueDropdown attribute is applied to a list, and IsUniqueList is set to true, then enabling this, will exclude existing values, instead of rendering a checkbox indicating whether the item is already included or not.
public bool ExcludeExistingValuesInList
ExpandAllMenuItems
If the dropdown renders a tree-view, then setting this to true will ensure everything is expanded by default.
public bool ExpandAllMenuItems
Filter
The filters we should use when calling AssetDatabase.FindAssets.
public string Filter
FlattenTreeView
By default, the dropdown will create a tree view.
public bool FlattenTreeView
IsUniqueList
True by default.
public bool IsUniqueList
SearchInFolders
Specify which folders to search in. Specifying no folders will make it search in your entire project. Use the Paths property for a more clean way of populating this array through attributes.
public string[] SearchInFolders

Properties

Paths

Specify which folders to search in. Specifying no folders will make it search in your entire project. You can decalir multiple paths using '|' as the seperator. Example:

[AssetList(Paths = "Assets/Textures|Assets/Other/Textures")]

This property is simply a more clean way of populating the SearchInFolders array.

public string Paths { get; set; }