Search Issue Tracker
Won't Fix
Votes
0
Found in
2019.4
2020.3
2020.3.27f1
2021.2
2022.1
2022.2
Issue ID
1402539
Regression
No
[Android] Input.touchPressureSupported returns true when built on Android devices
Reproduction steps:
1. Open the attached project "1402539_repro.zip"
2. Build the project on an Android device
3. Tap the screen
Expected result: Input.touchPressureSupported returns false
Actual result: Input.touchPressureSupported returns true
Reproducible with: 2019.4.36f1, 2020.3.31f1, 2021.2.16f1, 2022.1.0b12, 2022.2.0a8
Reproducible with these devices(Does not support Touch Pressure):
VLNQA00176, Xiaomi Redmi 4 (Redmi 4), Android 6.0.1, CPU: Snapdragon 430 MSM8937, GPU: Adreno (TM) 505
----------, Huawei - (ELS-NX9), Android 10, CPU: NOT FOUND, GPU: Mali-G76
Not reproducible with these devices(Supports Touch Pressure):
VLNQA00264, Samsung Galaxy S10+ (SM-G975F), Android 10, CPU: NOT FOUND, GPU: Mali-G76
Reproducible iOS devices:
VLNQA00310 - iPad Pro 12.9", 13.4.1 iOS
Not reproducible iOS devices:
VLNQA00358 - iPhone 12, 14.1 iOS
VLNQA00392 - iPad (9th generation), 15.0 iOS
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
- Last segment of a Sprite Shape Spline is affected by other segments' Sprite Variant change when no edge Sprite is selected
Resolution Note (2022.2.X):
There are too many variables for Android touch pressure to change the public API unless more people want it. A workaround to get touch pressure reliably on Android:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
int m_TouchPressureSupported = -1;
public bool touchPressureSupported
{
get
{
if (m_TouchPressureSupported == -1)
{
var javaClass = new AndroidJavaClass("com.unity3d.player.Utilities");
m_TouchPressureSupported = javaClass.CallStatic<int>("isTouchPressureSupported");
}
if (m_TouchPressureSupported == -1)
throw new System.Exception("Failed to query touchPressureSupported");
return m_TouchPressureSupported == 1;
}
}
private void OnGUI()
{
GUILayout.Space(20);
GUILayout.Label($"TouchPressureSupported: {touchPressureSupported}");
}
}