Skip to main content

Class SerializableDictionaryDrawer

Custom property drawer for SerializableDictionary. Displays the underlying serialized key-value list using a standard PropertyField.

[CustomPropertyDrawer(typeof(SerializableDictionary<,>), true)]
public class SerializableDictionaryDrawer : PropertyDrawer

Inheritance​

Remarks​

This implementation is a workaround for Unity's lack of native support for serializing dictionaries. In the future, this could be improved by using MultiColumnListView (available in newer Unity versions).

Methods​

CreatePropertyGUI(SerializedProperty)​

Creates the custom UI for the dictionary property.

public override VisualElement CreatePropertyGUI(SerializedProperty property)

Parameters​

NameTypeDescription
propertySerializedPropertyThe SerializedProperty to make the custom GUI for.

Returns​

VisualElement — The element containing the custom GUI.