Search Unity

ToolbarExtender - write your Editor UI code for the Unity Editor Toolbar, next to the play button

Discussion in 'Assets and Asset Store' started by marijnz, Aug 14, 2018.

  1. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
  2. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Great ! Do you know if there is a way to make buttons with icon and text in them ?
     
  3. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
    Hey, that's the same as any other Editor UI, just look for how to do those in general.
     
    Lars-Steenhoff likes this.
  4. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I managed to make some nice looking buttons in unity 2022, thanks for making this extension!

    Buttons.png
     
  5. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
    Cheers, enjoy! :)
     
    Lars-Steenhoff likes this.
  6. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    437
    sorry to necro, but I am aiming to do something really similar. Have you used the UI Toolkit for that? Any hints maybe?
     
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    https://github.com/marijnz/unity-toolbar-extender


    I used those buttons, but yes you can do some additional styling with .uss

    The way I set it up is to just use ExecuteMenuItem

    if(GUILayout.Button(new GUIContent(null,icon7, "Package Manager"), ToolbarStyles.commandButtonStyle))
    {
    EditorApplication.ExecuteMenuItem("Window/Package Manager");
     
    Last edited: Mar 22, 2024
    nehvaleem likes this.
  8. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    437
    Got it, many thanks! <3
     
  9. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    437
    It seems that it uses IMGUI, and now the buttons are slightly different than the default ones. I don't see a way to style them using USS (which would be much simpler, as now the top bar is rendered with UI Toolkit entirely).
     
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    can you show a screenshot?
     
  11. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    437


    it seems that there is imgui container injected by the toolbar extender and the provided button styling differs slightly than the unity's one.

     
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I think what I did is to make the UI Toolkit buttons look like the IMGUI buttons in order to make it all match. ( increased the size of the Toolkit buttons to match )