OdinMenuTreeExtensions

Class with utility methods for OdinMenuTrees and OdinMenuItems.

namespace Sirenix.OdinInspector.Editor
{
[ExtensionAttribute]
public static class OdinMenuTreeExtensions
}

Requirements

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

See Also

Extension Methods

Return Type Definition Description
IEnumerable<OdinMenuItem> AddAllAssetsAtPath(this OdinMenuTree, string, string, bool, bool) Adds all assets at the specified path. Each asset found gets its own menu item inside the specified menu item path.
IEnumerable<OdinMenuItem> AddAllAssetsAtPath(this OdinMenuTree, string, string, Type, bool, bool) Adds all assets at the specified path. Each asset found gets its own menu item inside the specified menu item path.
IEnumerable<OdinMenuItem> AddAllAssetsAtPathCombined(this OdinMenuTree, string, string, Type, bool) Adds all asset instances from the specified path and type into a single OdinMenuItem at the specified menu item path, and returns all menu items created in order to add the menuItem at the specified path..
IEnumerable<OdinMenuItem> AddAssetAtPath(this OdinMenuTree, string, string) Adds the asset at the specified menu item path and returns all menu items created in order to end up at the specified menu path.
IEnumerable<OdinMenuItem> AddAssetAtPath(this OdinMenuTree, string, string, Type) Adds the asset at the specified menu item path and returns all menu items created in order to end up at the specified menu path.
IEnumerable<OdinMenuItem> AddIcon(this IEnumerable<OdinMenuItem>, EditorIcon) Assigns the specified icon to the last menu item in the collection.
IEnumerable<OdinMenuItem> AddIcon(this IEnumerable<OdinMenuItem>, Sprite) Assigns the specified icon to the last menu item in the collection.
IEnumerable<OdinMenuItem> AddIcon(this IEnumerable<OdinMenuItem>, Texture) Assigns the specified icon to the last menu item in the collection.
IEnumerable<OdinMenuItem> AddIcon(this IEnumerable<OdinMenuItem>, Texture, Texture) Assigns the specified icon to the last menu item in the collection.
IEnumerable<OdinMenuItem> AddIcons(this IEnumerable<OdinMenuItem>, EditorIcon) Assigns the specified icon to all menu items in the collection.
IEnumerable<OdinMenuItem> AddIcons(this IEnumerable<OdinMenuItem>, Func<OdinMenuItem, Sprite>) Assigns the specified icon to all menu items in the collection.
IEnumerable<OdinMenuItem> AddIcons(this IEnumerable<OdinMenuItem>, Func<OdinMenuItem, Texture>) Assigns the specified icon to all menu items in the collection.
IEnumerable<OdinMenuItem> AddIcons(this IEnumerable<OdinMenuItem>, Texture) Assigns the specified icon to all menu items in the collection.
IEnumerable<OdinMenuItem> AddIcons(this IEnumerable<OdinMenuItem>, Texture, Texture) Assigns the specified icon to all menu items in the collection.
IEnumerable<OdinMenuItem> AddIcons<T>(this IEnumerable<OdinMenuItem>, Func<T, Sprite>) Assigns the specified icon to all menu items in the collection with the specified ObjectInstanceType.
IEnumerable<OdinMenuItem> AddIcons<T>(this IEnumerable<OdinMenuItem>, Func<T, Texture>) Assigns the specified icon to all menu items in the collection with the specified ObjectInstanceType.
void AddMenuItemAtPath(this OdinMenuTree, ICollection<OdinMenuItem>, string, OdinMenuItem) Adds the menu item at the specified menu item path and populates the result list with all menu items created in order to add the menuItem at the specified path.
IEnumerable<OdinMenuItem> AddMenuItemAtPath(this OdinMenuTree, string, OdinMenuItem) Adds the menu item at specified menu item path, and returns all menu items created in order to add the menuItem at the specified path.
IEnumerable<OdinMenuItem> AddObjectAtPath(this OdinMenuTree, string, Object, bool) Adds the specified object at the specified menu item path and returns all menu items created in order to end up at the specified menu path.
OdinMenuItem AddThumbnailIcon(this OdinMenuItem, bool) Assigns the asset mini thumbnail as an icon to all menu items in the collection. If the menu items object is null then a Unity folder icon is assigned.
IEnumerable<OdinMenuItem> AddThumbnailIcons(this IEnumerable<OdinMenuItem>, bool) Assigns the asset mini thumbnail as an icon to all menu items in the collection. If the menu items object is null then a Unity folder icon is assigned.
OdinMenuItem GetMenuItem(this OdinMenuTree, string) Gets the menu item at the specified path, returns null non was found.
IEnumerable<OdinMenuItem> SortMenuItemsByName(this IEnumerable<OdinMenuItem>, bool) Sorts the collection of menu items recursively by name with respects to numbers.
IEnumerable<OdinMenuItem> SortMenuItemsByName(this OdinMenuTree, bool) Sorts the entire tree of menu items recursively by name with respects to numbers.

Example

OdinMenuTree tree = new OdinMenuTree();
tree.AddAllAssetsAtPath("Some Menu Item", "Some Asset Path", typeof(ScriptableObject), true)
    .AddThumbnailIcons();
tree.AddAssetAtPath("Some Second Menu Item", "SomeAssetPath/SomeAssetFile.asset");
// etc...