Skip to content

Commit 198dd16

Browse files
committed
fix(state): only apply ifdef on Unity 2019.2 or newer
The ENABLE_LEGACY_INPUT_MANAGER was only added in Unity 2019.2 so any version before that won't understand the ifdef and therefore just output the debug warning. This fix wraps that whole block in a check to see if Unity 2019.2 or newer is being used, if its not then it just does the default process and if the user is using the new Input System but has this package installed then they won't get any debug warnings, but as this is based on such an old version of unity then this is acceptable.
1 parent a6ed746 commit 198dd16

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

Runtime/SharedResources/Scripts/UnityInputManagerAxis1DAction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ public float Multiplier
4747
/// <inheritdoc />
4848
public void Process()
4949
{
50+
#if UNITY_2019_2_OR_NEWER
5051
#if ENABLE_LEGACY_INPUT_MANAGER
5152
Receive(Input.GetAxis(AxisName) * Multiplier);
5253
#else
5354
Debug.LogWarning("The Legacy Unity Input Manager is disabled in the player settings.");
55+
#endif
56+
#else
57+
Receive(Input.GetAxis(AxisName) * Multiplier);
5458
#endif
5559
}
5660
}

Runtime/SharedResources/Scripts/UnityInputManagerAxis2DAction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ public float YMultiplier
8181
/// <inheritdoc />
8282
public void Process()
8383
{
84+
#if UNITY_2019_2_OR_NEWER
8485
#if ENABLE_LEGACY_INPUT_MANAGER
8586
Receive(new Vector2(Input.GetAxis(XAxisName) * XMultiplier, Input.GetAxis(YAxisName) * YMultiplier));
8687
#else
8788
Debug.LogWarning("The Legacy Unity Input Manager is disabled in the player settings.");
89+
#endif
90+
#else
91+
Receive(new Vector2(Input.GetAxis(XAxisName) * XMultiplier, Input.GetAxis(YAxisName) * YMultiplier));
8892
#endif
8993
}
9094
}

Runtime/SharedResources/Scripts/UnityInputManagerButtonAction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ public KeyCode KeyCode
3030
/// <inheritdoc />
3131
public void Process()
3232
{
33+
#if UNITY_2019_2_OR_NEWER
3334
#if ENABLE_LEGACY_INPUT_MANAGER
3435
Receive(Input.GetKey(KeyCode));
3536
#else
3637
Debug.LogWarning("The Legacy Unity Input Manager is disabled in the player settings.");
38+
#endif
39+
#else
40+
Receive(Input.GetKey(KeyCode));
3741
#endif
3842
}
3943
}

0 commit comments

Comments
 (0)