DictionaryLayout
The layout the Inspector uses to present a serialized Dictionary field.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Enum
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public enum DictionaryLayout
Remarks
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.
Examples
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>();}
Fields
Value | Description |
|---|---|
| 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. |
| TwoColumns | Shows keys and values side by side in two resizable columns. This is the default layout. |