Author Topic: [SOLVED]NGUI doesn't receive events from USB remote keyboard on Android mini PC  (Read 2373 times)

vvvua

  • Guest
Hello.
I'm using 2.6.2 version of NGUI and Unity3D 3.5.7 pro/Android basic/IOS basic. Everything works fine on my Nexus 7 tablet, HTC Sensation XE phone and Windows standalone build. Navigation doesn't work on Android mini PC TV HDMI stick dongle with USB air mouse (http://www.aliexpress.com/store/product/RC11-2-4G-Wireless-Air-Fly-Mouse-Keyboard-Full-Function-Mini-Mouse-Keyboard-for-Android-TV/803232_583970242.html).
I have a keyboard, joystick and mouse controls of NGUI elements. What other events have to be handled?
Thanks.
USB dongle is Android 4.0 device.
« Last Edit: July 16, 2013, 02:15:38 PM by vvvua »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Android purposely disables the mouse. Look inside UICamera's Awake function.

vvvua

  • Guest
Tnx for reply.
I've tried to add some calls to Start, then to Update and it seems to be the same behavior as before.
Now I have a script attached to Camera object with UICamera and other scripts.
Am I doing something wrong?
  1. bool firstRun=true;
  2.         void Update ()
  3.         {
  4.                 if(firstRun)
  5.                 {
  6.                         firstRun=false;
  7.                         UICamera.currentCamera.GetComponent<UICamera>().useMouse=true;
  8.                         UICamera.currentCamera.GetComponent<UICamera>().useController=true;
  9.                         UICamera.currentCamera.GetComponent<UICamera>().useKeyboard=true;
  10.                 }
  11.        
  12.         }
  13.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
'currentCamera' is set during event processing. I'm guessing it's 'null' in your case to begin with. You can only use 'current' series of properties inside NGUI event notifications. You can't use them outside them (like in your update).

Just do a gameObject.GetComponent<UICamera>() instead, and make sure the script is actually attached to the same object as the UICamera you are trying to modify.

vvvua

  • Guest
Thanks! Now it works as expected!