• 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
3
Question by Seneral · Mar 02, 2015 at 07:47 PM · editorwindowattributetooltip

Tooltips in Editor Windows?

Hey guys,

Do you know any alternative to the built-in Tooltip Atrribute which works with editor windows? The current is, as noted in the release notes, only for Inspectors, means only avaiable in MonoBehaviours. But I saw lots of other Editor Windows having Tooltips, so how would you implement it? Do I have to write my own code?

 [Tooltip("Some Tooltip")]

Works in a MonoBehaviour, where 'Tooltip' basically describes the TooltipAttribute Class. However, in an Editor Window, theres no Tooltip rather than the TooltipAttribute, and using either of those results in errors:

 Unexpected symbol `['

and all following code is 'unexpected'.

Do you know any common approach to this problem? Seneral

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

1 Reply

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

Answer by S_Darkwell · Mar 17, 2015 at 12:16 PM

You would actually use GUIContent to create a tooltip. Example:

 [CustomEditor(typeof(Example))]
 public class ExampleEditor : Editor
 {
     private void OnEnable()
     {
         Target = (Example) target;
     }
     
     public override void OnInspectorGUI()
     {
         Target.testFloat = EditorGUILayout.FloatField(new GUIContent("Test Float", "Here is a tooltip"), Target.testFloat);
     }
 }

It took me quite a while to find this myself.

Hope that helps!

Comment
Add comment · Show 5 · 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 Digx7 · Jun 07, 2019 at 03:01 AM 0
Share

It worked! Thanks so much, I felt like I was slam$$anonymous$$g my head against a wall all day trying to figure this out. :D

avatar image S_Darkwell Digx7 · Jun 07, 2019 at 10:55 AM 0
Share

Glad to have helped. :) Be well!

avatar image Kay86X · Jun 01, 2020 at 10:33 PM 0
Share

Glad I found this, I've been searching for over 40 $$anonymous$$utes!

avatar image Sirix · Jul 14, 2020 at 04:47 PM 0
Share

$$anonymous$$uchas gracias (Thank you very much)

avatar image unity_8XUtDRn37DKFfA · Jul 17, 2020 at 10:25 AM 0
Share

This worked like a charm and helped me immensely, thanks! I recommend making the tooltip a variable if it can appear in multiple places, or if it's too long.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

24 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there a list of variable attributes for C#? 2 Answers

Editor Script with for loop 1 Answer

Window Editor - Particle Effect Window Layout 0 Answers

Is there a way to get all editable fields of a component in a script? 2 Answers

Can't See all content of Editor 0 Answers


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