Inspector plugins

The inspector dock supports custom plugins to create your own widgets for editing properties. This tutorial explains how to use the EditorInspectorPlugin and EditorProperty classes to write such plugins with the example of creating a custom value editor.


To register these scripts as a new editor plugin, you have to create a plugin.cfg file as described in Making plugins.


We start by creating a script extending the EditorInspectorPlugin class. This is needed to initialize the plugin and add the custom property editor that we’ll later define.


extends EditorInspectorPlugin

func can_handle(object):
    # Here you can specify which object types (classes) should be handled by
    # this plugin. For example if the plugin is specific to your player
    # class defined with `class_name MyPlayer`, you can do:
    # `return object is MyPlayer`
    # In this example we'll support all objects, so:
    return true

func parse_property(object, type, path, hint, hint_text, usage):
    # We will handle properties of type integer.
    if type == TYPE_INT:
        # Register *an instance* of the custom property editor that we'll define next.
        # We return `true` to notify the inspector that we'll be handling
        # this integer property, so it doesn't need to parse other plugins
        # (including built-in ones) for an appropriate editor.
        return true
        return false


Next, we define the actual EditorProperty custom value editor that we want instantiated to edit integers. This is a custom Control and we can add any kinds of additional nodes to make advanced widgets to embed in the inspector.

extends EditorProperty
class_name MyIntEditor

var updating = false
var spin =

func _init():
   # We'll add an EditorSpinSlider control, which is the same that the
   # inspector already uses for integer and float edition.
   # If you want to put the editor below the property name, use:
   # `set_bottom_editor(spin)`
   # Otherwise to put it inline with the property name use:
   # To remember focus when selected back:
   # Setup the EditorSpinSlider
   spin.connect("value_changed", self, "_spin_changed")

func _spin_changed(value):
    if (updating):
    emit_changed(get_edited_property(), value)

func update_property():
    var new_value = get_edited_object()[get_edited_property()]
    updating = true
    updating = false