Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Can't Get Quest 2 Battery Level using CommonUsages.batteryLevel

Discussion in 'Input System' started by AtifCognitive, Sep 1, 2022.

  1. AtifCognitive

    AtifCognitive

    Joined:
    Aug 2, 2022
    Posts:
    1
    Hello,

    I'm working on a project using the Oculus Quest 2 in Unity 2019.4.40f1. Currently I am debugging in Windows using a Link Cable and encountered an issue.

    I am unable to get the Battery Level of the device using

    Code (CSharp):
    1. bool success = device.TryGetFeatureValue(CommonUsages.batteryLevel, out hmdBatteryLevel))
    This results in
    Code (CSharp):
    1. success = false
    and
    Code (CSharp):
    1. hmdBatterlyLevel =  0
    However, if I do:

    Code (CSharp):
    1. bool success = device.TryGetFeatureValue(CommonUsages.grip, out gripPress))
    I get the results -
    Code (CSharp):
    1. success = true
    and the
    Code (CSharp):
    1. out
    variable shows the grip press levels.

    Not sure what I'm doing wrong. Any suggestions will be helpful.

    Thanks,
    - Atif
    ---------------------------------------------
     
  2. michalekmarcin

    michalekmarcin

    Joined:
    Mar 28, 2019
    Posts:
    15
    @AtifCognitive I have the same problem. I'm trying to get controller battery level. For HMD this works for me:
    Code (CSharp):
    1. SystemInfo.batteryLevel