Creating Toolbar Items

Creating Toolbar Items is a relative simple task.

Create an editor class

Toolbar items are created by creating an editor class that inherits from one of the ToolbarItem base classes:

Class Purpose
DTToolbarButton Simple Button
DTToolbarToggleButton State Button
DTToolbarRadioButton State Button being part of a Radiogroup (always one selected)
DTToolbarRadioOffButton State Button being part of a Radiogroup (one or none selected)


To make the toolbar recognize your class, add a class attribute to your class:

[ToolbarItem(10,"Curvy","MyButton","My tooltip","myIcon,24,24","myLightSkinIcon,24,24")] 
  • Order - items are sorted by their order (ascending)
  • Project - the project name. Needs to be “Curvy”
  • Label - the button's label
  • Tooltip - a tooltip
  • Icon - item's icon in the form “name,width,height”. The file needs to be in a folder called “Resources”
  • LightIcon - (optional) the icon to use for light skin editor.

Add functionality

After that, you'll want to override or implement a few methods and properties to add functionality:

Method/Property Purpose Remarks
Ctor Constructor Add hotkey bindings here!
StatusBarInfo Gets the statusbar text to show when hovering over the item
OnSelectionChange() Called when hierarchy selection changes Set Visibility here at least!
OnClick() Called when the item is clicked
OnOtherItemClicked() Called when any other item is clicked Use this to e.g. set ShowClientArea
RenderClientArea() Called when additional UI should be drawn
OnSceneGUI() Regular OnSceneGUI call For preview or other SceneView drawing
HandleEvents() Called for UI events Use to catch additional hotkeys etc.
        project: "Curvy",
        label: "Set 1.",
        tooltip: "Set as first Control Point",
        icon: "setfirstcp,24,24"
    public class TBCPSetFirst : DTToolbarButton
        public override string StatusBarInfo => "Make this Control Point the first of the spline";
        public TBCPSetFirst() =>
                item: new EditorKeyBinding(
                    name: "Set 1. CP",
                    description: ""
        public override void OnClick()
            CurvySplineSegment cp = DTSelection.GetAs<CurvySplineSegment>();
            if (cp && cp.Spline)
                    objectToUndo: cp.Spline,
                    name: "Set first CP"
                cp.Spline.SetFirstControlPoint(controlPoint: cp);
        public override void OnSelectionChange()
            CurvySplineSegment cp = DTSelection.GetAs<CurvySplineSegment>();
            Visible = cp != null;
            Enabled = Visible 
                      && cp.Spline 
                      && cp.Spline.GetControlPointIndex(controlPoint: cp) > 0;

For all item types, use OnSelectionChange() to set Visible and Enabled

OnClick() is called on button click

Use the On property to get or set the button's state.

Additional UI

Override RenderClientArea() to show additional UI when the item is selected. The provided Rect parameter defines the starting position of the client area. Because toolbars can be shown on any side of the SceneView, you should use the provided methods to change the rect according to the toolbar's orientation:

  • Background() - renders a background box to host your content
  • SetElementSize() - define a single emement's size, used by the following methods (this is most useful if you're showing a submenu):
  • Advance() - advance the rect to a new line (top,bottom) or towards the inner (left,right)
  • AdvanceBelow() - advance the rect to a new line only

Use RadioGroup to define the button's group.