Kinds 1.3 – Custom Drawers

0
29

Summary

New Features

  • Custom Drawer for Component Tab
  • New Tab Types for GameObject Tags and Layers

Minor Updates

  • Visual Tags in Scene View are now filtered by Search Result
  • All Rows Count is displayed.

Custom Drawer for Component Tab

Now you can provide custom drawers for component tabs. The following is an example of the custom drawer for the Variables component of Visual Scripting (or Bolt).

And this is an example that displays the first material of Mesh renderer.

upload_2021-10-1_13-43-59.png

This is the source code. The full source code is included.

[KindsCustomDrawer(typeof(MeshRenderer), true)]
public class KindsMeshRendererCustomDrawer : KindsCustomDrawer
{
    public override IEnumerable<Column> GetColumns()
    {
        return new Column[]
        {
            new Column( ColumnType.Custom, "First Material", 100, "m_Materials", OnGui, OnCompare),
        };
    }

    private void OnGui(Rect rc, SerializedProperty sp)
    {
        if (sp.arraySize == 0)
        {
            EditorGUI.LabelField(rc, "Empty");
        }
        else
        {
            var firstElement = sp.GetArrayElementAtIndex(0);
            EditorGUI.ObjectField(rc, firstElement, GUIContent.none);
        }
    }

The custom drawers are displayed in the Kinds tab.

Enabling Custom Drawer Examples

Kinds & Kinds Pro contains custom drawer examples. They are basically disabled. To enable them, you have to define a symbol in the Project Settings like this.

  • KINDS_USE_EXAMPLE_ALL Enables all examples.
  • KINDS_USE_EXAMPLE Enables examples for built-in Unity components.
  • KINDS_USE_EXMPLE_VISUAL_SCRIPTING Enables Visual Scripting related examples. You can get compile errors if your project doesn’t have Visual Scripting or Bolt package.

Tags and Layers Tab

You can add a tag or layer tab in Kind 1.3. There are 3 sub-tabs in the Kinds tab now.

Tags and Layers tabs display activation state, name, hide flag, and scene.

LEAVE A REPLY

Please enter your comment!
Please enter your name here