unity-toolbar-extender icon indicating copy to clipboard operation
unity-toolbar-extender copied to clipboard

Remove default UI elements

Open CianNoonan opened this issue 6 years ago • 11 comments

It would be great to have the ability to move/edit/remove the existing toolbar buttons for further flexibility.

Having these take up less space would be great. image

CianNoonan avatar Nov 13 '18 11:11 CianNoonan

I very quickly tried to just draw over it with the toolbar color. This "works", except for that the elements underneath still respond (and have priority over custom buttons added). I'm pretty sure that what you're suggesting is possible, but it wouldn't have priority for me to do now, maybe you or someone else can do it!

image

marijnz avatar Nov 13 '18 11:11 marijnz

Ha, that's one way of doing it. If I can get it to work I'll submit a PR

CianNoonan avatar Nov 13 '18 14:11 CianNoonan

How did you draw over the top of the existing buttons? I feel I'm missing something here

CianNoonan avatar Nov 13 '18 15:11 CianNoonan

Made an example branch, here's the commit: https://github.com/marijnz/unity-toolbar-extender/commit/c44faf216120d381fbf70eecb520e4c000276a65

marijnz avatar Nov 13 '18 15:11 marijnz

And, any progress? :)

marijnz avatar Nov 14 '18 13:11 marijnz

I definitely was being silly, I can see that I just needed to expand the drawable area to draw over the buttons.

So far I've managed to prevent the tooltips from showing by setting GUIUtility.hotControl to a value other than 0(i.e 1000). This leads me to believe that these buttons completely circumvent the normal interface.

I'll keep toying with it in my spare time and see if there's a better solution using reflection.

CianNoonan avatar Nov 14 '18 17:11 CianNoonan

Moving the buttons would be pretty useful, Im considering inserting new stuff, but keeping whats there by default (in the same order, etc) but displaced.

@marijnz in your opinion this should be feasible?

Novack avatar Aug 26 '19 03:08 Novack

Looking quickly at the code, I guess it would be possible to take the children from the toolbar here: https://github.com/marijnz/unity-toolbar-extender/blob/9f4c9ba013f8e6cf3c21278e89bd450a16613a08/Assets/ToolbarExtender/Scripts/Editor/ToolbarCallback.cs#L49. Then either draw them or skip them. If somebody wants to try out..

marijnz avatar Aug 26 '19 08:08 marijnz

Hi there. I tried to select the m_currentToolbar scriptable object to see what's going on in there and guess what? the children list is empty! I also managed to draw a rect over play button in center of toolbar and hooked up my own buttons but the main buttons have higher priority for mouse events and i also tried to tweak GUI.depth variable and also used event system to see if mouse is inside my button rects but there is no luck. Any help would be appreciated.

AlirezaTabasi7 avatar Feb 25 '20 19:02 AlirezaTabasi7

FYI, this might be easier with 2021, using Visual Elements.

marijnz avatar Jul 10 '21 20:07 marijnz

Thanks for chimming in! I gave this a try time ago without luck, will try again using VE, later this year after updating to U2021.

Novack avatar Jul 10 '21 21:07 Novack