Plugin Button Icon

I want to create a plugin with button on toolstrip. But I don’t want text. I want a custom icon. I tried many ways, and still nothing. In logs i have output of invalid assetID but it’s copied from editor. I dont understand this, please help. Here is a code:

using System;
using System.Collections.Generic;
using FlaxEngine;
using FlaxEditor;
using FlaxEditor.GUI;

namespace Plugins
    /// <summary>
    /// TestPlugin Script.
    /// </summary>
    public class TestPlugin : EditorPlugin
        private ToolStripButton btn;

        public override void InitializeEditor()

            var guid = new Guid("15fa8b0045de732834800b8027779b8d");       <-- nevermind i need to parse it                
            var tex = Content.Load<Texture>(guid);          <----- This everytime null.

            var btn = Editor.UI.ToolStrip.AddButton(Editor.Icons.Add32); <--- I want custom icon here not editor  one                                                                                                                                                       
            btn.Clicked += () => MessageBox.Show("Wow!!!");

        public override void DeinitializeEditor()
                btn = null;


I’m getting the same issue. You might want to report it as a bug. Seems like an issue with the asset loader, because it also happens to me in play mode, even when loading an asset using its editor copied Guid.

OK I reported a bug:

Tell me how you create spritehandle from texture? I’m mean


This function use spritehandle. Should I Import Sprite instead of texture? Or is it a way to convert Texture to sprite? I tried import sprite but I don’t know if it’s working becouse I can’t load stuff with guid.

I also tried with a SpriteHandle and it still wouldn’t work. I do, however, think the UI only works with SpriteAtlases. This way you can split a bunch of icons into a single texture. However, if you only have one icon, you can just import it as a SpriteAtlas and create a single Sprite from it. Here’s the code I was using:

SpriteAtlas iconsAtlas = Content.LoadAsync<SpriteAtlas>(id);
if (!iconsAtlas || iconsAtlas.WaitForLoaded())

SpriteHandle icon = iconsAtlas.FindSprite("ButtonTest");
var btn = Editor.UI.ToolStrip.AddButton(icon);

Thank you it works but not with guid. I replace Content.LoadAsync<SpriteAtlas>(id); with Content.LoadAsync<SpriteAtlas>(path); and now it works.

1 Like