The symptom splits in two
First: the setting disappears after a restart, which means you never saved. Second: it saved, but the first run uses the old key anyway, which is an ordering problem. The second is harder to find, because opening the settings screen shows the new key correctly.
Saving is one string
Extract the overrides, store them as a string, and restore that at startup. Do not save the action asset itself.
// save
PlayerPrefs.SetString("bindings", actions.SaveBindingOverridesAsJson());
PlayerPrefs.Save();
// restore
var json = PlayerPrefs.GetString("bindings", string.Empty);
if (!string.IsNullOrEmpty(json))
actions.LoadBindingOverridesFromJson(json);Order decides the outcome
Attach overrides after enabling the action map and anything already reading input keeps the old binding. Pin the order instead.
- Create the action asset.
- Load and apply the saved overrides.
- Then enable the action maps.
- The player object starts reading input.
Reset removes overrides only
Building reset by reloading the asset throws away other settings with it. Removing only the overrides is safer.
actions.RemoveAllBindingOverrides();
PlayerPrefs.DeleteKey("bindings");Expected result and next step
When the very first input after a restart uses the new key, this item is done. Display is next: showing the raw binding name produces different strings per device, so build a separate display name.
Official documentation review
Verified
Reviewed the article's code and procedure against official Unity documentation and marked it ready for publication. This is not a claim of an independent Unity project or device reproduction; version- or device-specific reports will be checked in that environment as follow-up.