Skip to content

Instantly share code, notes, and snippets.

@nekomimi-daimao
Created February 9, 2024 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nekomimi-daimao/d1452a182cc16893071b3d7041b61f2f to your computer and use it in GitHub Desktop.
Save nekomimi-daimao/d1452a182cc16893071b3d7041b61f2f to your computer and use it in GitHub Desktop.
UnityのInspectorでDictionary的に使う
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nekomimi.Daimao
{
[Serializable]
public class SerializableTable<TKey, TValue>
{
public SerializableKeyValue<TKey, TValue>[] table;
public Dictionary<TKey, TValue> ToDictionary => table.ToDictionary(kv => kv.key, kv => kv.value);
}
[Serializable]
public class SerializableKeyValue<TKey, TValue>
{
public TKey key;
public TValue value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment