From 8dabc472f72ad7632a9f7d36f71a1211d0f8eee7 Mon Sep 17 00:00:00 2001 From: Chipmunk <65827213+ChipmunkMC@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:40:58 -0400 Subject: [PATCH] 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) --- Assets/Scripts/Assembly-CSharp/DeviceInfo.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/Scripts/Assembly-CSharp/DeviceInfo.cs b/Assets/Scripts/Assembly-CSharp/DeviceInfo.cs index 29c3d76f..632c2301 100644 --- a/Assets/Scripts/Assembly-CSharp/DeviceInfo.cs +++ b/Assets/Scripts/Assembly-CSharp/DeviceInfo.cs @@ -6,8 +6,7 @@ public class DeviceInfo { get { - RuntimePlatform runtimePlatform = Application.platform; - return runtimePlatform == RuntimePlatform.IPhonePlayer || runtimePlatform == RuntimePlatform.Android; + 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) } }