To derive from Toolbar, you'll have to do it in IL, because it's internal. See attached IL file. You can ignore GameObjectEditor that's something else :)
I've also attached mockup of classes, which I compile and then disassemble into IL
UnityIL.Editor.il.txtMockup.cs.txt
There's internal ToolbarWrapper and static class ToolbarExtension which exposes callbacks and other useful methods (see mockups)
Create wrapper, copy all serialized properties, replace it
MainView.children[0] is always Toolbar, just replace it
There's also Toolbar.get (field surprisingly), which is probably a good idea to replace
ToolbarExtension.cs.txt
IL compilation command:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm UnityIL.Editor.il /dll /OUTPUT=%~dp0UnityIL.Editor.dll
Simple case works, see screenshot below.
I've encountered some issues when switching layout (not sure why).
Done on Unity 2018.2.10f1
Hey, I was thinking about different approach:
Sounds impossible, but it actually isn't.
To derive from Toolbar, you'll have to do it in IL, because it's internal. See attached IL file. You can ignore GameObjectEditor that's something else :) I've also attached mockup of classes, which I compile and then disassemble into IL UnityIL.Editor.il.txt Mockup.cs.txt
There's internal
ToolbarWrapper
and static classToolbarExtension
which exposes callbacks and other useful methods (see mockups)Create wrapper, copy all serialized properties, replace it
MainView.children[0]
is always Toolbar, just replace it There's alsoToolbar.get
(field surprisingly), which is probably a good idea to replace ToolbarExtension.cs.txtIL compilation command:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm UnityIL.Editor.il /dll /OUTPUT=%~dp0UnityIL.Editor.dll
Simple case works, see screenshot below. I've encountered some issues when switching layout (not sure why). Done on Unity 2018.2.10f1