- Home /
Can I add custom button to toolbar of Unity Editor?
I want to add a button / custom UI element in the space next to "Play" button. Is that doable? If so how?
Answer by valyard · Jun 03, 2015 at 05:03 PM
Short answer: NO.
Long answer:
If you really want to do this you will have to hack UnityEditor.dll. You can do this using Mono.Cecil.
But first you need to find the code which draws this part of the interface. This is easy using ILSpy because Unity doesn't obfuscate its DLLs.
The code is to be found in UnityEditor.Toolbar class DoPlayButtons method. Using Mono.Cecil you could inject your own code to draw custom UI elements after Play/Pause buttons and compile your own UnityEditor.dll. But this approach is not scalable. You will have to patch it every time Unity releases a new version and it will be hard to distribute.
Answer by Jeason1997 · Apr 11, 2017 at 07:49 AM
@valyard 's answer is right, but, it can be scalable if you use cecil to dynamic inject the "UnityEditor.dll" replace static hack the dll
Answer by nikolicdarko · Jul 20, 2021 at 10:35 PM
@Paulius-Liekis @valyard Yes you can and it's really easy https://github.com/marijnz/unity-toolbar-extender