A game about forced loneliness, made by TACStudios
1using UnityEngine;
2using UnityEngine.InputSystem;
3
4public class RebindSaveLoad : MonoBehaviour
5{
6 public InputActionAsset actions;
7
8 public void OnEnable()
9 {
10 var rebinds = PlayerPrefs.GetString("rebinds");
11 if (!string.IsNullOrEmpty(rebinds))
12 actions.LoadBindingOverridesFromJson(rebinds);
13 }
14
15 public void OnDisable()
16 {
17 var rebinds = actions.SaveBindingOverridesAsJson();
18 PlayerPrefs.SetString("rebinds", rebinds);
19 }
20}