summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample32_Dictionary.cs
blob: 8d5869a305a51a79bd1f9e9143fc3a9bbfa2034c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using UnityEngine;
using System;
using System.Collections;

using AdvancedInspector;

[AdvancedInspector]
public class AIExample32_Dictionary : MonoBehaviour
{
    // The UDictionary is a Unity friendly dictionary that fully implement all .NET collection/dictionary interface
    // However, Unity is unable to properly save a generic object, so we must create a non-generic version like this;
    // The Serializable attribute is also required.
    [Serializable]
    public class StringGameObjectDictionary : UDictionary<string, GameObject> { }

    // The Advanced Inspector is able to display anything having the ICollection or IDictionary interfaces.
    // Note that it is best to initialize the variable yourself in case of Dictionaries;
    [Inspect]
    public StringGameObjectDictionary myDictionary = new StringGameObjectDictionary();
}