Fix touchscreen input on anything that isn't Android or iOS

Previously, to check if touch input should be used, the game checked if the runtime platform was Android or iOS. As such, using a mouse on these platforms (well, Android, did not test iOS) does not work. On other platforms, touch input appeared to work, however since it was technically mouse input features, some things, such as zooming in and out of levels did not work. This commit should fix that for all platforms.

Instead of checking the runtime platform, now, it checks if the device supports touchscreen (regardless of platform), and if there is at least one current touch. As such, both types of input should now be supported on all platforms. (this was tested on a windows 8.1 tablet pc)
This commit is contained in:
Chipmunk 2023-10-03 22:40:58 -04:00
parent 1cdef0f16e
commit 8dabc472f7

View file

@ -6,8 +6,7 @@ public class DeviceInfo
{ {
get get
{ {
RuntimePlatform runtimePlatform = Application.platform; return Input.touchSupported && Input.touchCount != 0; // * Input.touchCount is checked so that if there are no touches, mouse input will be used (this is assummed to be called on every update)
return runtimePlatform == RuntimePlatform.IPhonePlayer || runtimePlatform == RuntimePlatform.Android;
} }
} }