Debugging C++ Code for Virtual Reality (Mac)
Debugging C++ code for virtual reality is notoriously puzzling on Mac. For example, you may find that even Meta Quest's own guide for Debugging Unity Apps for Oculus Quest In-Headset requires an Oculus Link cable to be connected to a PC. This is problematic as a developer who only has a Mac, and may not want to/does not have access to a Virtual Machine (ex. Paperspace).
Here’s a guide on how to debug Unity C++ code built for Oculus Quest 2 using Debug.Log() via the Android Logcat package, which will allow you to have access to a console that can print log statements and error messages as you build and run your program through your quest headset, hooked to your Mac computer.
You will need:
A Unity Development Environment with the Android SDK installed.
A Quest headset in developer mode with a cable to connect it to your Mac.
Installing and Using Logcat:
First, you’ll need to download the Android Logcat package. This can be done by going to Window > Package Manager in the Unity editor and downloading and installing the Android Logcat package from the Unity Registry.
You can now use Debug.Log() in your C++ code to output messages to the log.
Voila! You can now see the output of the console live from your build on your headset.