# Custom component Inspectors

To get full control over how a component draws its presence in the Inspector, you can implement a custom `PropertyDrawer` script for it.

{% hint style="info" %}
If you are unfamiliar with Property Drawers, check out [the official Unity documentation](https://docs.unity3d.com/6000.1/Documentation/ScriptReference/PropertyDrawer.html) for them.
{% endhint %}

To draw the component correctly, create a script and inherit from `SceneComponentDrawer` class. Then, override the `DrawComponent()` method, like this:

```csharp
using SuperScenes.Editor.CustomEditors;
using UnityEditor;
using UnityEngine.UIElements;

namespace SuperScenes.Editor
{
    [CustomPropertyDrawer(typeof(EnemyData))]
    public class EnemyDataPropertyDrawer : SceneComponentDrawer
    {
        protected override VisualElement DrawComponent(SerializedProperty property)
        {
            VisualElement inspector = base.DrawComponent(property);

            inspector.Add(new HelpBox("This box has been added by a custom PropertyDrawer.",
                HelpBoxMessageType.Info));

            return inspector;
        }
    }
}
```

In the method, you can create a completely new editor from scratch, or you can leverage `base.DrawComponent(property)` to still draw the original Inspector and add elements to it (like in the example above).

{% hint style="info" %}
To create a custom Property Drawer for Scene Components, you must use [UI Toolkit](https://docs.unity3d.com/6000.1/Documentation/Manual/UIElements.html).

However, you can still return an `IMGUIContainer` element from your override of `DrawComponent()` , and implement your UI in `OnGUI`. Check out Unity's own [IMGUIContainer documentation](https://docs.unity3d.com/Manual/UIE-uxml-element-IMGUIContainer.html).
{% endhint %}
