Fun, Free Online Games
Open/Close MenuMENU

Unity Tips - Adding headings and tooltips

Unity Tips - Adding headings and tooltips

I thought I would give something back to the Unity community as everyone has been so helpful to me in the past.


This article will show you how to add headings, spacing and tool tips to your unity scripts so that they are spaced out and more organised in the 'inspector' view.

I found this extreemly helpful in viewing my variables and objects in a more organised manner than one big long list.

As soon as I found out about this, I added it to every script!

What's more, this is actually extreemly easy to do.


These are just extra lines you add to the script, below are examples in C Sharp, I'm sure these will work equally well on other languages.


1) Headings
These are the most handy one, they add a nice bold heading above your variables in the inspector.
Simply add this where you want the heading to show:
[Header("My Heading:")]





2) Spacing
A nice one to separate things out a bit, you can decide how much of a gap to add with the value in brackets.
Simply add this line where you want a gap to appear:





3) Tooltips
More helpful to remind you want this parameter is for, without the need to open your script and read any comments you made.
This one needs to go ABOVE the line you want to add a tool tip for, eg:

[Tooltip("My Strings Tool Tip")]
public string MyString = "Some string value";


And here is how your code might look once you add all these:



We hope you found this useful.
Happy coding!

Written by Ford Hollett on the 11/7/2017


  • Submit A Comment/Review:

  • Name:
  • Email: (Required but won't be shown.)
  • Comment:
  • I am not a robot:
  • Prove you are not a robot by answering this simple question:
    4 plus 3 is:
back to topTop
This website uses cookies to enable essential site functionality, as well as analytics. You may change your settings at any time or accept the default settings. Manage Preferences
Cookie Preferences
These cookies are required to enable basic website functionality, without them the site wont work properly.
These cookies help us understand how the website performs, how visitors interact with the site and whether there may be any technical issues. These cookies usually don't collect information that identifies a visitor.