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

Determine if Android device is daydream or cardboard without calling VRSettings.LoadDeviceByName()?

Discussion in 'Daydream' started by Buddeh, Aug 2, 2017.

  1. Buddeh

    Buddeh

    Joined:
    Apr 13, 2017
    Posts:
    2
    Hi all,

    I am creating a hybrid Non-VR / VR app for Android.

    The app starts off in Non-VR mode (with the 'None' SDK at the top of the list).

    At the moment I use the following lines of code to determine what the VR capability of the device is:

    Code (CSharp):
    1. string[] DaydreamDevices = new string[] { "daydream", "cardboard" };
    2.  
    3. VRSettings.LoadDeviceByName(DaydreamDevices);
    Depending on the device, I would like to load different scenes respectively, some may be in VR, some may be Non-VR. Although, by running the above code, the application goes into VR mode, which if I am progressing to a Non-VR scene, means I have to force the SDK back to 'None' with:

    Code (CSharp):
    1. VRSettings.LoadDeviceByName("");
    I am wondering if it is at all possible to determine whether the specific Android device which is running the app is a Daydream device or a Cardboard device without having to use the above code.

    Kind Regards,

    Nick
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    There isn't much we can do other then attempt to initialize Daydream and fallback to Cardboard if it succeeds. There is no API that I am aware of in the GoogleVR library to tell if the device is Daydream or Cardboard capable. The only thing I can think you might be able to do is somehow request device information and check the device against a hand built whitelist based on the Google Daydream supported hardware web page, but that seems like a time consuming strategy.
     
  3. Buddeh

    Buddeh

    Joined:
    Apr 13, 2017
    Posts:
    2
    Thank you for your response joejo,

    That is what I thought the process would be.

    Thanks again,

    Nick