Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

mobile VR and wireless controller conflicts?

Discussion in 'AR/VR (XR) Discussion' started by metaphysician, Mar 17, 2017.

  1. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    this is more of a general question and frustration with mobile VR, as i have no specific code handling events at the moment. here's the situation. i am making builds in Gear VR and in Google Cardboard, and i wish to use a standard bluetooth wireless game controller. i've put in the Standalone Input module in the Event System, added inputs for the controller in the Input Manager, and when built, and having luck on my side, i can use the controller to navigate the UI successfully.

    i say luck because if i touch the screen when inserting the phone into the device, or it recognizes gaze tracking when inserted, any further input from the joystick is ignored. it seems the gaze input is partially enabled by the Scripting Define CROSS_PLATFORM_INPUT designator, which seems difficult to delete if you have the Standalone Input component, but the screen touch detection is really frustrating. bottom line - i don't mind it losing UI focus to these other inputs, but i just wish it would then recognize the joystick input after that. i've mitigated it a bit by using a Cardboard build with the transition screen. Gear VR is currently resulting in separate non-related issues that are killing my audio, but as i recall they suffered much of the same issues when making a build, with the added difficulty of having to avoid touching the D-Pad on the side as well which would result in the same loss of UI focus..

    really not sure of how to solve this issue. is it possible to easily disable the mobile screen touch inputs on the build, or let the controllers work cooperatively so that it would recognize both inputs as valid? or is this more likely to have a script based solution? any assistance appreciated!
     
  2. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Hmm, this is an issue that I may be encountering.

    I had a similar issue in another engine. I hacked around it by forcing the java view containing the controller input handlers to hog focus: if it received a lost focus event it asked system to refocus it. In that situation however I was not using standard cardboard UI overlay (just side by side in engine) so I did not have to worry about locking users out of cardboard UI.

    So is this an issue in general, is it a problem using generic HID input device with cardboard?
     
  3. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    well, it's not an issue on Android itself. i build single screen with no issue. i tried to build Gear VR and also in Cardboard. i'm using a Gear VR to run this but i bought a disabler plugin that allows me to switch to Cardboard mode by deactivating the Gear VR service. i believe both build targets experience the same issue. everything works and looks fine ('fine' here is determined by the presence of a highlighted UI button), but if it detects screen touch, gaze input or other conflicting input, the highlighting will disappear and using the joystick does not bring them back into focus. losing the focus is not a big deal to me but i want to be able to use the joystick to regain focus. this is in Unity 5.6 beta BTW, since that's the only one with native Cardboard support. i could consider using the 5.5.1 version if it was more stable. but the version number performance is quite tricky - using 5.5.0 i was unable to make any kind of stereoscopic build, and was tearing my hair out until someone recommended i upgrade to 5.5.1. so that's where things stand at the moment.
     
  4. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    I'm also using Unity5.6B for cardboard/daydream (although I do not have daydream device to test on yet).
    Today I will try a simple scene with cube and joypad hooked up for cardboard, see if joypad keeps working after screen touches etc...
     
  5. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    @SiliconDroid - yes definitely let me know your progress on this. regardless of what audio engine i eventually end up using, the screen interaction thing still has to be worked out.

    best,
    scott
     
  6. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    I just tried controller with GoogleVR.

    Stock unity input settings, just reading Input.GetAxis("xxx").
    Unity 5.6.0f1 cardboard export to Android 5.0.
    Moga Bluetooth Controller bound to ZTE-Axon7.

    Tried touching screen lots, pausing app and resuming, entering cardboard menu and back to game.
    It all seems solid, reading sticks analog values perfectly.:)