static void SetButtons() { if (!modEnabled.Value || ZInput.instance == null) { return; } ZInput zInput = ZInput.instance; Dictionary <string, ZInput.ButtonDef> m_buttons = Traverse.Create(zInput).Field("m_buttons").GetValue <Dictionary <string, ZInput.ButtonDef> >(); m_buttons.Clear(); using (var enumerator = context.Config.GetEnumerator()) { while (enumerator.MoveNext()) { if (enumerator.Current.Key.Section == "Config") { continue; } ButtonInfo info = new ButtonInfo(enumerator.Current.Key.Key, (ConfigEntry <string>)enumerator.Current.Value); if (Enum.TryParse <KeyCode>(info.key, out KeyCode keyCode)) { zInput.AddButton(info.button, keyCode, info.repeatDelay, info.repeatInterval); } else { zInput.AddButton(info.button, info.key, info.inverted, info.repeatDelay, info.repeatInterval); } } } zInput.Save(); Dbgl("Finished setting buttons"); }