- Home /
Touch disabled on Android, Unity 5
I just upgraded a project to Unity 5.0. Unfortunately, doing so seems to have broken touch in our Android build. I built a couple of dummy scenes trying OnMouseDown events, Unity 5 UI Buttons, and Unity GUI.Button, but none seem to work.
It seems that might be related to OnMouseEnter events mixing with Touch calls (though we don't use Touch anywhere), so I tried deleting almost everything from the project, but it still doesn't register input. It does seem to work when I create a new project - I'm guessing it's something in Project Settings but not sure what.
I realize there's probably not a lot to go on here, but has anyone else encountered a similar issue (with Unity 5 or in general)?
--edit-- I tried a build with this code:
protected void Update()
{
Vector3 mPos = Vector3.zero;
if(Input.touchCount>0)
{
mPos = Input.GetTouch(0).position;
Debug.Log("touchPos " + mPos);
}
mPos.z = 10;
Vector3 cMPos = Camera.main.ScreenToWorldPoint(mPos);
transform.position = cMPos;
}
but got no debug.log messages and the object didn't move.
Also, I just started using Unity Remote 4 recently... Tried running with that and it seemed to work. Hmm...
Found this excellent link - I seem to have the same problem: http://answers.unity3d.com/questions/915011/touch-no-longer-works-on-android-in-unity-5.html
Seems plugins and the Android$$anonymous$$anifest may be the culprit; though so far it hasn't worked
Answer by hubatish · Apr 11, 2015 at 02:55 PM
Check out plugins. In my case the Stan's Assets Android Native plugin needed updating, so I removed it and re-imported it. This remade my AndroidManifest and fixed my problem.
Also, this question is pretty much the same as mine, though their solution was different: http://answers.unity3d.com/questions/915011/touch-no-longer-works-on-android-in-unity-5.html
Answer by Veldars · Apr 07, 2015 at 11:35 AM
I've encountered a similar issue and i have fix it by adding a box collider on my UI Button.
Unfortunately I don't think it's related to the type of button - I tried a bunch as mentioned.
I also ran this in an Update loop but got no output: if(Input.touchCount>0) { Vector3 mPos = Input.GetTouch(0).position; Debug.Log("touchPos " + mPos); }
going to add this as edit to question.
Answer by liortal · Apr 11, 2015 at 04:55 PM
This is a bug that happens in some cases.
In Unity 5.0.1 this was resolved, as written in the release notes here: http://unity3d.com/unity/whats-new/unity-5.0.1
Android: Fixed crashes / touch problems when applying ForwardNativeEventsToDalvik to a non-NativeActivity.
Your answer
Follow this Question
Related Questions
Buttons touches dont work if touch splash screen 1 Answer
Converting screen coordinates to world coordinates 1 Answer
Fix Rotate Object with touchscreen on X and Y axis 0 Answers
Testing in Unity5 0 Answers
Since upgrading to 5.0: Unable to convert classes into dex format. See the Console for details. 1 Answer