Firstborn/Library/PackageCache/com.unity.inputsystem@1.4.4/Samples~/RebindingUI/RebindSaveLoad.cs
Schaken-Mods b486678290 Library -Artifacts
Library -Artifacts
2023-03-28 12:24:16 -05:00

21 lines
487 B
C#

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);
}
}