File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Assets/Samples/RebindingUI Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -9,18 +9,18 @@ namespace UnityEngine.InputSystem.Samples.RebindUI
9
9
/// </summary>
10
10
public class RebindSaveLoad : MonoBehaviour
11
11
{
12
- /// <summary>
13
- /// The associated input action asset (Required).
14
- /// </summary>
15
12
[ Tooltip ( "The associated input action asset to be serialized to player preferences (Required)." ) ]
16
13
public InputActionAsset actions ;
17
14
18
- /// <summary>
19
- /// The associated player preference key.
20
- /// </summary>
21
15
[ Tooltip ( "The player preference key to be used when serializing binding overrides to player preferences (Required)." ) ]
22
16
public string playerPreferenceKey ;
23
17
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
+
24
24
/// <summary>
25
25
/// Loads binding overrides from player preferences and applies them to the associated input action asset.
26
26
/// </summary>
@@ -50,12 +50,14 @@ public void Save()
50
50
51
51
private void OnEnable ( )
52
52
{
53
- Load ( ) ;
53
+ if ( loadOnEnable )
54
+ Load ( ) ;
54
55
}
55
56
56
57
private void OnDisable ( )
57
58
{
58
- Save ( ) ;
59
+ if ( saveOnDisable )
60
+ Save ( ) ;
59
61
}
60
62
61
63
private bool IsValidConfiguration ( )
You can’t perform that action at this time.
0 commit comments