- Home /
Touch no longer works on Android in Unity 5
I have tried both touch checking in Update and mouse events, and with Unity 5 neither events are fired.
The device is a Nexus 7 2012 running Lollipop for reference.
The same problem is reproduced on devices: - Samsung Galaxy S5 (G-900H) Android 4.4.2, - Samsung Galaxy S3 (GT-I9300) Android 4.3, - Samsung Galaxy $$anonymous$$ega (GT-I9200) Android 4.4.2 - on this device a part of UI is not even displayed, - Samsung Galaxy Note (S$$anonymous$$-P601) Android 4.4.2
We have upgraded our 4.6.x project to Unity 5.0.
same error..it doesn't work if you upgraded your old 4.6.x project. But if you create a new project and put UI stuffs in there, touch working back on android devices.. $$anonymous$$ind of weird but it really is a very big bug.
same issue here. 4.6.x project upgraded to Unity 5, UI is not working on Android device. (even with a new scene with just a canvas and a button). But a whole new project, no issue.
Its is probably in relation to the way the API Updater has changed the code, if it has changed at all.
Pull up your old code next to you new code and note the differences. Post them here, then we can see if they look correct or not.
I was just thinking the exact same thing. I created a test scene in Unity 5 with GUI to show Input.touchCount and it worked, but the exact same script didn't work in my 4.6-upgraded-to-5.0 project. Have any of you checked to see if a bug report has been submitted?
Answer by Riwels · Mar 10, 2015 at 09:54 AM
I fixed this problem by replacing the unity activities from the AndroidManifest.xml, for this one:
<activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="fullSensor" android:name="com.unity3d.player.UnityPlayerNativeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
Now it's working to me with Amazon Ads and GameCircle. Try yourself with your plugins.
Original AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amazon.unity.AmazonMobileAdsPlugin"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:debuggable="false"
android:icon="@drawable/app_icon"
android:label="@string/app_name" >
<activity
android:name="com.unity3d.player.UnityPlayerProxyActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:label="@string/app_name"
android:screenOrientation="sensor" >
</activity>
<activity
android:name="com.unity3d.player.UnityPlayerActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:label="@string/app_name"
android:screenOrientation="sensor" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="unityplayer.ForwardNativeEventsToDalvik"
android:value="true" />
</activity>
<activity
android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:label="@string/app_name"
android:screenOrientation="sensor" >
</activity>
<activity
android:name="com.unity3d.player.VideoPlayer"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.amazon.device.ads.AdActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
<uses-feature android:name="android.hardware.touchscreen" />
<uses-feature
android:name="android.hardware.touchscreen.multitouch"
android:required="false" />
<uses-feature android:glEsVersion="0x00020000" />
Modified AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amazon.unity.AmazonMobileAdsPlugin"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:debuggable="false"
android:icon="@drawable/app_icon"
android:label="@string/app_name" >
<activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="fullSensor" android:name="com.unity3d.player.UnityPlayerNativeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<!--- Amazon Ads -->
<activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
<uses-feature android:name="android.hardware.touchscreen" />
<uses-feature
android:name="android.hardware.touchscreen.multitouch"
android:required="false" />
<uses-feature android:glEsVersion="0x00020000" />
Answer by luniac · Mar 06, 2015 at 07:48 AM
This is how i fixed it after hours and hours and hours of BULL****...
i have neatplug social plugins, admob and facebook, they have stuff to do with the android manifest. I had to delete both plugins, all traces of them, then reimported the plugins and thankfully all errors went away and when i built to android the touches worked.
Touchscript was in no way involved...
Plugins. Read this.
http://docs.unity3d.com/$$anonymous$$anual/UpgradeGuide5-Plugins.html
i did read it, the settings seemed fine to me. and those plugins had nothing to do with touch functionality.
How do i find out if a plugin is 32 bit native or 64 bit native?
it's failing without any plugins like I said before... Create a new project in Unity 4.6.x -> Add new UI button -> Close the project... Open it with Unity 5.0 and touch no longer works.. it contains no plugins and not even a script.
Answer by fermmmm · Apr 27, 2015 at 09:51 AM
I have the same problem but a little different, TouchPhase.Began is detected but TouchPhase.Ended or TouchPhase.Canceled is never called. Input.touches.Length doesn't update the value when there is no touch on the screen, so is never 0, only updates when pressing my finger on the screen. Bug report here: http://fogbugz.unity3d.com/default.asp?692519_b7i8q6l9oapd8ral 5.0.1 still has the problem.
Answer by felixwcf85 · Apr 27, 2015 at 03:38 AM
I have Unity 5 5.0.1f and the problem still exists as someone claimed that the problem is fixed in 5.0.1. Does anyone else has this kind of sh!tty problem?
I also converted my 4.6.+ project into 5.0.1 and the touch is not working on my Android phone!!!
Answer by wilberh · Dec 11, 2015 at 12:35 PM
Is touch available on Unity Remote 4, using Unity version 5.1.0f3 ?