Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Debugging for Oculus Quest 2 on Mac

Discussion in 'VR' started by Alixar, Oct 25, 2020.

  1. Alixar

    Alixar

    Joined:
    Mar 13, 2019
    Posts:
    50
    Hi all,

    I was hoping to get some guidance from the community, it's the first time I get my hands dirty with VR and I'm having quite a few issues.

    I only have a MacBook that works fine for traditional Unity development but on the Oculus I can only do Build and Run, I can't seem to be able to have the Game view update if I play a scene. The problem with this approach (other than being slow, around 1 minute per cycle) is that I cannot live debug.

    Is there anyone, working on Mac, that can kindly point me to how properly setup Unity 2020 for Oculus debugging?

    Many thanks for any help and suggestion.
     
    holyjessy likes this.
  2. Alixar

    Alixar

    Joined:
    Mar 13, 2019
    Posts:
    50
    A few hours later...

    I managed to setup the environment (VSCode + Unity on Mac) for live debugging. Iterations are still slow but at least I can set breakpoints. I can use the traditional "play scene" setup at it plays locally but takes no inputs from the Oculus, so it's useless in my case. If anyone knows how to overcome this (if possible) that would be immensely appreciated!

    Thank you
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    It's only useless if you leave it useless. Encapsulate your inputs so that they can come from either the actual VR controllers, or from your testing stand-ins (e.g. a gamepad, or keyboard/mouse), and the rest of your code doesn't know or care which it is. Then you can test in the debugger.

    I've been using exactly this for my Quest development on my MacBook Pro since before the Quest came out, and it's been working fine for me.
     
  4. Alixar

    Alixar

    Joined:
    Mar 13, 2019
    Posts:
    50
    This is indeed a good idea, thanks for sharing your process. I was initially puzzled as I couldn't figure out how to run code on the Oculus and see what was happening in the Game view on Mac. After a few days of working on it it's much more clear how to proceed. Thanks for your help.
     
    JoeStrout likes this.
  5. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    How do you handle switching back and forth between VR mode and pancake mode?
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I don't understand the question. On the Quest, it's always in VR mode. When I run within the editor, for testing, it's always in pancake mode (but "pretending" to be VR).
     
  7. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I didn't realize you could use the quest on a mac to see the game preview mode in Unity on the headset itself. That's possible? I'd love to switch my development from my Win 10 machine to my mac.
     
  8. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You can't. That's why I said it's pancake mode (i.e., displaying an the flat screen of my laptop or its attached external monitor).
     
  9. aharriscrowne

    aharriscrowne

    Joined:
    Sep 4, 2013
    Posts:
    1
    Would anyone be willing to share their code for substituting keyboard / game pad controls for oculus touch controls? One of my biggest challenges has been finding a way to simulate the 3d position of the controls for game view.
     
  10. ABD-UCH

    ABD-UCH

    Joined:
    Nov 22, 2018
    Posts:
    1
    how you can test your oculus quest 2 project directly from unity on macOS using the device.
     
  11. patkellydesigns

    patkellydesigns

    Joined:
    Nov 30, 2016
    Posts:
    1
    This thread needs to be answered or removed. There's a lot of discussion but no actual direction.
     
  12. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    That's not how the forum works. Also, what you claim isn't true — the original poster found my suggestion useful, and reported success with it on Oct 27, 2020.

    Some of the follow-up questions have been less clear (and one of them seems to repeat the original question, which was already answered). But that doesn't mean the thread is useless, and even if it were, we don't delete threads here (unless they are obvious spam).
     
    Lion_C likes this.
  13. david66peterson

    david66peterson

    Joined:
    Nov 2, 2021
    Posts:
    1
    Hi! Does anyone know how to debug if you build to oculus quest 2 from a MacBook pro?
    Currently, I can't use "play mode" and when building, my debug.log (obviously) doesn't show up in the console.

    I'm asking because I did create all desired logic with keyboard+mouse as input, but the XR Interaction toolkit has differences which cause issues..
     
  14. hotlabs

    hotlabs

    Joined:
    Apr 11, 2021
    Posts:
    10
    So far the only way I know for debugging on MacOS is to use adb. Connect your device and run from console

    Code (CSharp):
    1. adb logcat -s Unity
    I wasn't able to make breakpoints work with VS Code so if anybody knows how to do it, please post a detailed process. That would be much appreciated.
     
  15. RiesVriend

    RiesVriend

    Joined:
    Jun 19, 2021
    Posts:
    1
    I just setup MacOS with Unity 2022 and Rider 2023, and remote debugging on Android (Meta Quest 2) works fine.

    Steps:
    - build and run with script debugging enabled in Unity. This deploys a running APK file to the device.
    - From unity, open a Script. This launches Rider assuming its your default editor in Unity. In Rider, Run | Attach to Unity Process and select the line with the USB/Android device
    - set and hit breakpoints as needed
     
    hotlabs likes this.