Use decorator drawers to improve inspector view of your scripts

If you’re writing a custom script then most probably you want to manipulate its public field values from the Inspector. By default, the Inspector fields are placed next to each other and the field name is the only information that you receive. You can write a custom editor, but this requires creating another script with a lot of code and this takes time. If you want to keep it simple then there’s a way! Just use the Decorator Drawers!

Decorator Drawers are attributes that can be set on any public field in your script to change the way it is displayed in the Inspector view (in fact, it renders some additions before the field is rendered). There are two built-in decorator drawers:


The SpaceAttribute can be used to add some spacing in the Inspector view. In this way you can separate two or more groups of properties so they are more readable.

Let’s take a look at this example:

This script manifests itself like this in the Inspector view:

decorator drawer without space

To improve the readability we can split these properties to two groups: the health and the shield group. In order to do that, just add [Space(10)] before the shield field.

The number 10 here means that we want the space to be 10 pixels tall. Here’s how it went:

decorator drawer space example


Please note that adding a [Space(10)] there doesn’t mean “put space between maxHealth and shield fields” but instead “draw a space before shield property”. Usually it won’t make a difference, but it’s good to know if you encounter any issues.


The header attribute adds a header label before the field that this attribute is assigned to. Here’s the example code:

And here’s how it looks like:

decorator drawers header example


As you can see it’s just similar to SpaceAttribute but there’s also a header label visible. And it has been done with a single attribute without writing a custom editor script!

Using Space and Header at the same time

You can use both properties at the same time. All you need to know is that these will be rendered in the reversed order. So if you write:

The space will be rendered at first, then the header. Don’t worry if you forget about that. You will notice your mistake once you look at the Inspector.

Writing custom Decorator Drawers

You’re probably thinking whether you could write your own Decorator Drawers. Yes, you can! Yet we will look into this topic in another article. Thank you for reading!

AdvancedAugmented RealityTutorial
Corner and surface detection in AR Part 3
Calculation corner based on three surfaces Introduction Last time you have learnt about ARKit...
Building a Turn-Based Multiplayer Game with GameSparks and Unity: Part 4/4
Welcome back to our GameSparks tutorial. In this final part we’ll set up the Game scene and...
Artificial locomotion in Unity using Machine Learning Part 3
Training and results ML-Agents training One of the most essential parts of training is hyperparameter...
Call The Knights!
We are here for you.
Please contact us with regards to a Unity project below.

The Knights appreciate your decision!
Expect the first news soon!
hire us!