Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by crypticmind · Nov 10, 2013 at 11:17 PM · custom editortoolbar

How are these mini-toolbars created?

Before anything, sorry if this has been already answered. I just don't know how to search for this, and I resorted to asking here after several attempts at googling for it.

Many panels in Unity have a cute mini-toolbar with filter fields, dropdown menus, and buttons, e.g. Project, Hierarchy, Scene, Console, etc.

The Console has a toolbar to clear it and further filter its contents

I'm making an editor for a custom asset, and I'd like to know how they were implemented. I went through the scripting reference and I just couldn't find any component for it, and my searching Google was unsuccessful.

The custom asset I'm talking about is a dialogue asset with a not-so-simple object graph where this kind of toolbar for editing could come in very handy.

Any pointers will be appreciated.

Thanks!

toolbar_in_panel.png (23.1 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by BMayne · Sep 11, 2015 at 04:46 AM

There are also in EditorStyles.toolbar

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rutz · Dec 21, 2015 at 01:40 AM 0
Share

Yes, you are right. We also can use EditorStyles.toolbar.

EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

avatar image
2

Answer by rutz · Sep 11, 2015 at 03:54 AM

You may already found the answer I guess but maybe someone still need it.

private bool collapsed = false;
private bool clearOnPlay = false;
public void OnGUI() {
    EditorGUILayout.BeginHorizontal("Toolbar", GUILayout.ExpandWidth(true));
    if (GUILayout.Button("Clear", "ToolbarButton", GUILayout.Width(45f))) {
        Debug.Log("You click Clear button");
    }
    // Create space between Clear and Collapse button.
    GUILayout.Space(5f);
    // Create toggles button.
    collapsed = GUILayout.Toggle(collapsed, "Collapse", "ToolbarButton");
    clearOnPlay = GUILayout.Toggle(clearOnPlay, "Clear on Play", "ToolbarButton");
    // Push content to be what they should be. (ex. width)
    GUILayout.FlexibleSpace();
    EditorGUILayout.EndHorizontal();
}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

multiple choice quiz game, I had error when I would submit/update the score using toolbar, it increases rapidly, can someone tell me my error is? thank you in advance here is my code. 0 Answers

custom button 2 Answers

Custom control in editor. 1 Answer

Transform using custom editor doesn't recorded in animation 2 Answers

Selecting an object in the scene would assign it to an empty gameobject in the inspector 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges