Author Topic: buttons not working in unity 5 and android  (Read 4562 times)

MicroGiant

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 3
    • View Profile
buttons not working in unity 5 and android
« on: March 07, 2015, 04:16:32 PM »
I have just updated my game to unity 5 and have also updated ngui to the latest version, I was using ngui 2.7 and when I updated to unity 5 and exported to android no of the buttons worked so I though ill upgrade ngui as well but still nothing is working? any help would be most appreciated

MicroGiant

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #1 on: March 09, 2015, 05:31:52 AM »
Does any one have any ideas how to start debugging this? it works perfectly on the pc and the move from 2.7 to 3.8 was quite painless but I really don't know were to start to try to find out what the android issue is as it quite a problem not being to use the gui

Gavin_Hayler

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 3
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #2 on: March 09, 2015, 06:06:22 AM »
Same problem. Just upgraded our project today to use Unity 5.0.0f4 and using NGUI 3.8.0. Buttons work fine in the editor, but on an android phone they don't respond at all. Any ideas what could be causing this or how to start debugging it?

deathguide

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #3 on: March 09, 2015, 10:27:57 PM »
Same problem.  I am using Unity 5.0.0f4  and NGUI 3.7.9.

Gavin_Hayler

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 3
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #4 on: March 10, 2015, 02:11:45 AM »
Looks like this is a problem with Unity and not NGUI. I'm still trying to track it down, but the real problem is that Input.touchCount always returns 0. Only seems to be a problem with upgraded projects as fresh projects seem to have no problem.

Magic Frame

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #5 on: March 10, 2015, 03:29:55 AM »
same problem here!  :-\

herhangi

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 2
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #6 on: March 10, 2015, 05:08:51 AM »
I was waiting for an answer here to solve the same problem, but it did not happen.
After Gavin_Hayler told that there was no problem in new Unity projects, I started digging for the differences between new projects and my updated project and found out that cause of the problem was custom AndroidManifest.xml. Unity changed how AndroidManifest system works and changed some values inside the manifest file so that our old manifest files corrupts the proper file and does not let input flow.

So, you should alter your AndroidManifest.xml in proper way possible, or remove it for a while until plugin that uses it updates it.

Gavin_Hayler

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 3
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #7 on: March 10, 2015, 06:00:29 AM »
Yup finally tracked it down to the same cause. Android manifest file was the issue. For what it's worth, I added this to the UnityPlayerActivity in the manifest and it worked again:
  1. <intent-filter>
  2.    <action android:name="android.intent.action.MAIN" />
  3.    <category android:name="android.intent.category.LAUNCHER" />
  4. </intent-filter>
  5. <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
  6.  

So the entire activity looks like this:
  1.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
  2.       <intent-filter>
  3.         <action android:name="android.intent.action.MAIN" />
  4.         <category android:name="android.intent.category.LAUNCHER" />
  5.       </intent-filter>
  6.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
  7.     </activity>
  8.  

MicroGiant

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: buttons not working in unity 5 and android
« Reply #8 on: March 11, 2015, 04:04:44 AM »
Thank you herhangi and Gavin for finding, sharing and fixing the problem.