private bool TryAddNewPair(PropertyWrapper wrapper, SerializedProperty newKey) { bool suchKeyExists = false; for (int i = 0; i < wrapper.Count; i++) { var curKey = wrapper.GetKeyAtIndex(i); if (Holder.KeysAreEqual(curKey, newKey)) { suchKeyExists = true; } } if (!suchKeyExists) { int curSize = wrapper.Count; wrapper.InsertPairAtIndex(curSize); Holder.PutValue(wrapper.GetKeyAtIndex(curSize)); wrapper.Apply(); return(true); } else { CustomDebug.LogError("Key already exists " + newKey.ToString()); return(false); } }