visit
To start, go to the Unity website and create an account. If you don’t have one, download Unity. The personal edition should be fine for the vast majority of projects.
VR sample is a great starting point, and it comes with components that handle tracking the headset and controllers. Some settings still need tweaking so it knows what kind of headset to use.
Navigate to Edit → Project Settings, find XR Plug-in Management. Once found, select the Android tab and check the Oculus setting. You may see a similar setting below, but it may vary depending on the Unity version.
Instructions are available on Meta’s website . Please follow the instructions from Oculus to pair the device to the PC and your mobile phone. Once your headset is paired, the key is to enable Development mode, open the Oculus mobile app, and go to the Devices tab. Choose Headset Settings, “Developer Mode” heading should be visible. Tap and enable the toggle. A prompt will appear to create a developer account. Follow the instructions from Oculus to turn on the developer mode.
Set the stereoscopic rendering mode: In the Unity Player settings, under "XR Settings," set the stereoscopic rendering mode to "Single Pass Instanced" or "Single Pass Multiview." These modes optimize rendering for VR by reducing the rendering overhead.
Optimize GPU performance: Use the Unity Profiler to identify and optimize GPU performance bottlenecks. Look for excessive draw calls, overdraw, and high GPU utilization. Optimize shaders, reduce the number of polygons, and minimize texture usage.
Use static batching: Unity's static batching combines multiple small meshes into a single, larger mesh, reducing draw calls. Mark small objects as static and enable static batching in the Unity Player settings under "XR Settings" to improve performance.
Optimize for mobile performance: Quest 2 is a mobile VR device, so optimizing for mobile performance is crucial. Optimize textures by reducing their resolution and using compression formats suitable for mobile platforms. Use fewer materials and simplify shaders when possible.
Minimize CPU overhead: Avoid heavy scripting and computations that can strain the CPU. Optimize scripts by reducing unnecessary calculations, using object pooling, and avoiding expensive operations within Update loops. Use the Unity Profiler to identify CPU bottlenecks.
Implement occlusion culling: Occlusion culling prevents the rendering of objects that are not visible to the player, reducing GPU load. Unity provides built-in occlusion culling tools that you can use to optimize your scenes.
Use LOD (Level of Detail): Implement Level of Detail for 3D models to reduce the polygon count of objects as they move further away from the player. This helps improve performance by reducing the GPU load.
Test and iterate: Remember that optimization is an iterative process! Regularly test your project on the Oculus Quest 2 hardware to identify performance issues. Use the Oculus Developer Hub and Unity Profiler to gather performance data and iterate on your optimizations.
Get back to the Unity project and navigate to File/Build and Run menu. This will open a window with various target platforms Unity can build for. Go with the Android option since the Oculus has Android as an underlying operating system.
From the settings listed in the left menu, the ones that should be modified for this first build are Texture Compression and Run Device. Set the compression to ASTC. From the Run Device dropdown menu, choose Quest 2 headset (the headset name will have an ID associated with the device). Click Refresh if there is no device listed. Make sure you add the current scene to the build by clicking Add Open Scenes button.
Now is the time to try it yourself! Press Build and Run. The build will be saved. Once the building is done and successful, the game will be saved to the headset and launched. Put on the headset and try it yourself!