The layout the Inspector uses to present a serialized Dictionary<TKey, TValue> field.
Set the layout with DictionaryDisplayAttribute.layout on a dictionary field, or with DictionaryDisplayForTypeAttribute for a dictionary identified by type. The default is DictionaryLayout.TwoColumns.
The user can change the layout at any time from the dictionary header's context menu. Their choice persists and takes precedence over the value set by the attribute.
using System.Collections.Generic; using UnityEngine;
public class SpawnSettings : MonoBehaviour { // Stack each value under its key, behind a per-entry foldout. [DictionaryDisplay(layout = DictionaryLayout.OneColumnWithValueFoldout)] [SerializeField] private Dictionary<string, GameObject> spawnPoints = new Dictionary<string, GameObject>(); }
| Property | Description |
|---|---|
| TwoColumns | Shows keys and values side by side in two resizable columns. This is the default layout. |
| OneColumnWithValueFoldout | Stacks each value under its key in a single column, with every value behind a collapsible foldout. |
| OneColumnWithValueVisible | Stacks each value under its key in a single column, with every value always shown inline. |