Skip to content

Commit c0720c1

Browse files
committed
Made load/save configurable on RebindSaveLoad component.
1 parent ba19e19 commit c0720c1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Assets/Samples/RebindingUI/RebindSaveLoad.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ namespace UnityEngine.InputSystem.Samples.RebindUI
99
/// </summary>
1010
public class RebindSaveLoad : MonoBehaviour
1111
{
12-
/// <summary>
13-
/// The associated input action asset (Required).
14-
/// </summary>
1512
[Tooltip("The associated input action asset to be serialized to player preferences (Required).")]
1613
public InputActionAsset actions;
1714

18-
/// <summary>
19-
/// The associated player preference key.
20-
/// </summary>
2115
[Tooltip("The player preference key to be used when serializing binding overrides to player preferences (Required).")]
2216
public string playerPreferenceKey;
2317

18+
[Tooltip("Specifies whether to load and apply binding overrides when the component is enabled")]
19+
public bool loadOnEnable = true;
20+
21+
[Tooltip("Specifies whether to save binding overrides when the component is disabled")]
22+
public bool saveOnDisable = true;
23+
2424
/// <summary>
2525
/// Loads binding overrides from player preferences and applies them to the associated input action asset.
2626
/// </summary>
@@ -50,12 +50,14 @@ public void Save()
5050

5151
private void OnEnable()
5252
{
53-
Load();
53+
if (loadOnEnable)
54+
Load();
5455
}
5556

5657
private void OnDisable()
5758
{
58-
Save();
59+
if (saveOnDisable)
60+
Save();
5961
}
6062

6163
private bool IsValidConfiguration()

0 commit comments

Comments
 (0)