1234567891011121314151617181920 |
- using UnityEngine;
- using UnityEngine.InputSystem;
-
- public class RebindSaveLoad : MonoBehaviour
- {
- public InputActionAsset actions;
-
- public void OnEnable()
- {
- var rebinds = PlayerPrefs.GetString("rebinds");
- if (!string.IsNullOrEmpty(rebinds))
- actions.LoadBindingOverridesFromJson(rebinds);
- }
-
- public void OnDisable()
- {
- var rebinds = actions.SaveBindingOverridesAsJson();
- PlayerPrefs.SetString("rebinds", rebinds);
- }
- }
|