44using System ;
55using System . Collections . Generic ;
66
7- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
7+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
88using UnityEngine . InputSystem ;
99using UnityEngine . InputSystem . Controls ;
1010#endif
@@ -13,15 +13,15 @@ namespace UnityEngine.UI.Extensions
1313{
1414 public static class UIExtensionsInputManager
1515 {
16- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
16+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
1717 private static bool [ ] mouseButtons = new bool [ 3 ] { false , false , false } ;
1818 private static Dictionary < KeyCode , bool > keys = new Dictionary < KeyCode , bool > ( ) ;
1919 private static Dictionary < String , bool > buttons = new Dictionary < String , bool > ( ) ;
2020#endif
2121
2222 public static bool GetMouseButton ( int button )
2323 {
24- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
24+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
2525 if ( Mouse . current == null )
2626 {
2727 return false ;
@@ -35,7 +35,7 @@ public static bool GetMouseButton(int button)
3535
3636 public static bool GetMouseButtonDown ( int button )
3737 {
38- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
38+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
3939 if ( Mouse . current == null )
4040 {
4141 return false ;
@@ -57,7 +57,7 @@ public static bool GetMouseButtonDown(int button)
5757
5858 public static bool GetMouseButtonUp ( int button )
5959 {
60- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
60+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
6161 if ( Mouse . current == null )
6262 {
6363 return false ;
@@ -76,7 +76,7 @@ public static bool GetMouseButtonUp(int button)
7676
7777 public static bool GetButton ( string input )
7878 {
79- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
79+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
8080 ButtonControl buttonPressed = GetButtonControlFromString ( input ) ;
8181
8282 if ( ! buttons . ContainsKey ( input ) )
@@ -90,7 +90,7 @@ public static bool GetButton(string input)
9090#endif
9191 }
9292
93- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
93+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
9494 private static ButtonControl GetButtonControlFromString ( string input )
9595 {
9696 if ( Gamepad . current == null )
@@ -112,7 +112,7 @@ private static ButtonControl GetButtonControlFromString(string input)
112112
113113 public static bool GetButtonDown ( string input )
114114 {
115- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
115+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
116116 ButtonControl buttonPressed = GetButtonControlFromString ( input ) ;
117117
118118 if ( buttonPressed . isPressed )
@@ -140,7 +140,7 @@ public static bool GetButtonDown(string input)
140140
141141 public static bool GetButtonUp ( string input )
142142 {
143- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
143+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
144144 ButtonControl buttonPressed = GetButtonControlFromString ( input ) ;
145145
146146 if ( buttons [ input ] && ! buttonPressed . isPressed )
@@ -156,7 +156,7 @@ public static bool GetButtonUp(string input)
156156
157157 public static bool GetKey ( KeyCode key )
158158 {
159- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
159+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
160160 KeyControl keyPressed = GetKeyControlFromKeyCode ( key ) ;
161161 if ( ! keys . ContainsKey ( key ) )
162162 {
@@ -169,7 +169,7 @@ public static bool GetKey(KeyCode key)
169169#endif
170170 }
171171
172- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
172+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
173173 private static KeyControl GetKeyControlFromKeyCode ( KeyCode key )
174174 {
175175 if ( Keyboard . current == null )
@@ -203,7 +203,7 @@ private static KeyControl GetKeyControlFromKeyCode(KeyCode key)
203203
204204 public static bool GetKeyDown ( KeyCode key )
205205 {
206- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
206+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
207207 KeyControl keyPressed = GetKeyControlFromKeyCode ( key ) ;
208208 if ( keyPressed . isPressed )
209209 {
@@ -230,7 +230,7 @@ public static bool GetKeyDown(KeyCode key)
230230
231231 public static bool GetKeyUp ( KeyCode key )
232232 {
233- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
233+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
234234 KeyControl keyPressed = GetKeyControlFromKeyCode ( key ) ;
235235 if ( keys [ key ] && ! keyPressed . isPressed )
236236 {
@@ -245,7 +245,7 @@ public static bool GetKeyUp(KeyCode key)
245245
246246 public static float GetAxisRaw ( string axis )
247247 {
248- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
248+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
249249 if ( Gamepad . current == null )
250250 {
251251 return 0f ;
@@ -269,7 +269,7 @@ public static Vector3 MousePosition
269269 {
270270 get
271271 {
272- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
272+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
273273 return Mouse . current . position . ReadValue ( ) ;
274274#else
275275 return Input . mousePosition ;
@@ -281,7 +281,7 @@ public static Vector3 MouseScrollDelta
281281 {
282282 get
283283 {
284- #if UNITY_2019_OR_NEWER && ! ENABLE_LEGACY_INPUT_MANAGER
284+ #if ( UNITY_2019 || UNITY_2020 ) && ! ENABLE_LEGACY_INPUT_MANAGER
285285 return Mouse . current . position . ReadValue ( ) ;
286286#else
287287 return Input . mouseScrollDelta ;
0 commit comments