using UnityEngine; using System.Collections; using System.Collections.Generic; namespace MoreMountains.Tools { /// /// Dictionary extensions /// public static class MMDictionaryExtensions { /// /// Finds a key (if there's one) that matches the value set in parameters /// /// /// /// /// /// public static T KeyByValue(this Dictionary dictionary, T value) { T key = default; foreach (KeyValuePair pair in dictionary) { if (pair.Value.Equals(value)) { key = pair.Key; break; } } return key; } } }