Author Topic: Feature Request: Android Mouse Support  (Read 1771 times)

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Feature Request: Android Mouse Support
« on: March 14, 2013, 02:40:04 PM »
Hi,

We've received a couple requests by our users to have bluetooth mouse support added to our Android products. I looked into this and tried to hack a solution for it but not really happy with it. The problem of course is that if you process both mouse and touch support the input will be registered twice. So my thought is to not explicitly set the mouse boolean in the Awake() and in the update have a special case that handle mouse input if there hasn't been any touch input if both are enabled. 

All Line Numbers are original line numbers of the CS not the line numbers after modification

UICamera.cs Line 687
  1. if (Application.platform == RuntimePlatform.Android ||
  2.         Application.platform == RuntimePlatform.IPhonePlayer)
  3. {
  4.         useTouch = true;
  5.         if (Application.platform == RuntimePlatform.IPhonePlayer)
  6.         {
  7.                 useMouse = false;
  8.                 useKeyboard = false;
  9.                 useController = false;
  10.         }
  11. }
  12.  

UICamera.cs 760.cs
  1. // Process touch input
  2. if (useTouch) ProcessTouches();
  3.  
  4. // Update mouse input
  5. if ((useMouse && !useTouch) || (useTouch && mIsEditor) || (useTouch && useMouse && mTouches.Count <= 0)) ProcessMouse();
  6.  

Does have a more elegant solution (not adding a lot of work every time I update) to get mouse support working on Android with NGUI?