protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); var customMenuStyle = new OdinMenuStyle { BorderPadding = 0f, AlignTriangleLeft = true, TriangleSize = 16f, TrianglePadding = 0f, Offset = 20f, Height = 23, IconPadding = 0f, BorderAlpha = 0.323f }; tree.DefaultMenuStyle = customMenuStyle; tree.Config.DrawSearchToolbar = true; // Adds the custom menu style to the tree, so that you can play around with it. // Once you are happy, you can press Copy C# Snippet copy its settings and paste it in code. // And remove the "Menu Style" menu item from the tree. tree.AddObjectAtPath("Menu Style", tree.DefaultMenuStyle) .AddThumbnailIcons(); for (int i = 0; i < 5; i++) { var customObject = new SomeCustomClass() { Name = i.ToString() }; var customMenuItem = new MyCustomMenuItem(tree, customObject); tree.AddMenuItemAtPath("Custom Menu Items", customMenuItem); } tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Tree", "Plugins", typeof(ScriptableObject), true, false) .AddThumbnailIcons() .SortMenuItemsByName(); tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Flat", "Plugins", typeof(ScriptableObject), true, true) .AddThumbnailIcons(true) .SortMenuItemsByName(); tree.AddAllAssetsAtPath("Only Configs has Icons", "Plugins/Sirenix", true, false) .Where(x => x.ObjectInstance as ScriptableObject) .AddThumbnailIcons(); return(tree); }
public MyCustomMenuItem(OdinMenuTree tree, SomeCustomClass instance) : base(tree, instance.Name, instance) { this.instance = instance; }