AR + VR: Mixed Reality (MR) with Unity & Google Cardboard XR Plugin
AR + VR: Mixed Reality (MR) Camera — Unity Asset that uses Google Cardboard XR Plugin (former Google VR SDK) to display 2D or 3D objects as though they were in the real world mixing Virtual Reality and Augmented Reality. It’s Unity MR Camera for 80% of all Mobile Devices.
Contents
Features of AR + VR: Mixed Reality (MR) Camera
Bring the enchanting Power of Mixed Reality into your amazing Game or App:
- Cross-platform Mobile MR Camera: iOS, Android.
- 3-minute installation for your own AR + VR Scene.
- Covering a wide range of mobile devices.
- Google Cardboard XR Plugin (former Google VR SDK) to implement Virtual Reality.
- No using of other AR Engines like Unity AR Foundation, ARCore, ARKit, Vuforia, etc.
- Real-Time AR Shadows.
- Basic Editor Testing.
- Optimized Gaze-based Reticle Pointer based on TextMesh Pro (2 Non-Animated States).
Mixed Reality adds virtual elements to the physical world and surrounds you with game objects, being in full immersion with VR Headset.
Package Contains
- Demo in Mixed Reality of Interaction with Objects.
- Camera Feed on Background (docs).
- Permission Scene with Camera Permission Request using free Native Camera.
- Loading Screen to switch scenes seamlessly.
Check the Map of Unity Assets to choose the product that best suits your needs.
Tutorial
This tutorial is relevant for MR Camera 4.0+.
Tutorial for the previous version can be found only in the asset folder.
Getting Started with AR + VR: Mixed Reality (Unity MR)
Folders & Files in the package by default:
- Makaka Games;
- Plugins;
- XR.
Steps
If you have any issues with the first launch then just Reach Support with Invoice Number and Get Help.
If you read this tutorial from PDF, first check the latest docs online to get actual information.
- Create New Unity Project with Unity 2022.3.18 & “3D” Template.
- File > Build Settings > iOS or Android > Switch Platform.
- Next Packages must be manually installed with Git & Unity Package Manager:
- Native Camera 1.4.2.
- Google Cardboard XR Plugin for Unity 1.23.0 – I recommend using this version because the latest version has bugs. Here is a Hash value for installing: 0d822d2031c3f5b3d9d7eebc1c6603fd689ed411
- Edit > Project Settings > XR Plug-in Management > Select Cardboard XR Plugin under Plug-in Providers for both: iOS & Android.
- Download and import AR + VR: Mixed Reality (MR) into Unity.
- Warning Windows:
- Click “Import” to overwrite the Project Settings with predefined ones.
- Click “Install/Upgrade” for Package Manager Dependencies.
- Warning Windows:
- Next Packages are provided with Unity Package Manager, and they are already installed for this Asset by default. If packages are missing (Warning Window did not appear) then install them again with Package Manager (advanced settings enabled: “Pre-release Packages”):
- TextMesh Pro 3.0.8:
- Always Required: Window > TextMeshPro > Import TMP Essential Resources;
- XR Legacy Input Helpers 2.1.10;
- XR Plugin Management 4.4.1.
- TextMesh Pro 3.0.8:
- Reopen Unity Project.
- Open Scene: Makaka Games > MR > MR Camera > Scenes > Demo.
- Test in the Unity Editor or Build for Mobile.
If you are new to Google Cardboard XR Plugin for Unity, check the following guide.
VR Only Mode
So if you want to use the asset without AR, in VR Only mode, do next in Demo Scene:
- Delete “CameraFeedOnBackground” from the scene.
- Player MR > Main Camera > Clear Flags > Skybox.
- AR Ground > Mesh Renderer > Materials > Set to “Default Material” or whatever you want.
Issue Solving
No Stereo View & Freezed Game Object on Device
So, if you accurately followed all points in the installation tutorial above, then try next:
- Remove XR Plugin Management package from Unity Package Manager.
- Build for Mobile Device.
If you have no success then install XR Plugin Management package in Unity Package Manager and build again. Cardboard XR Plugin must be checked for your Platform in “Edit > Project Settings > XR Plug-in Management > iOS/Android”.
Testing
You can test the project in the Unity Editor this way:
- Right Mouse Button for Camera Movement.
- Left Mouse Button for Simulating of Pressing the Cardboard trigger button this frame (Google.XR.Cardboard.Api.IsTriggerPressed) — Tested for Screen Touches on Mobile Device.
Unity Editor doesn’t provide Stereo View.
Use Fullscreen of Game View in Unity Editor while testing to get a seamless experience.
Debug Logging of Gaze-based Reticle Pointer
Gaze-based Reticle Pointer shows is there a Game Object (specially prepared for VR like in Demo Scene) in front of the Camera.
To understand the state of Pointer, you can turn on Debug Logging in CameraPointerCustom.cs component of the Main Camera game object.
Mobile Devices
Tested with Smartphones & Google Cardboard with Unity’s Built-in Render Pipeline (not URP):
- iOS 17 on iPhone XS Max.
- Android 13 on Samsung Galaxy A71.
Limitations
- Hardware and Software Requirements are restricted by Requirements of Google Cardboard XR Plugin.
- Camera Rotation and Camera Movement are controlled only with Google Cardboard XR Plugin.
- UI Buttons on World Space Canvases must have Box Collider.
- Google Cardboard must have camera hole.
Google Cardboard XR Plugin is still under development. If you have any issues on its side, then try to Search Solutions on GitHub.
Support
First, read the latest docs online.
If it didn’t help, get the support.
Changelog
Check the current version of MR Camera on Asset Store.
The latest versions will be added as soon as possible.
4.0:
Improvements:
- Unity 2022.3.18;
- Google Cardboard XR Plugin 1.23.0;
- Native Camera 1.4.2.
- Camera Feed on Background 2.0 (docs).
3.3:
Improvements:
3.2:
Improvements:
- Unity 2021.3.4 for iOS & Android;
- Google Cardboard XR Plugin 1.16.0;
- Native Camera 1.3.3.
3.0:
Improvements:
- Unity 2019.4.36 for iOS/Android;
- Unity 2021.2.10 for Android;
- Google Cardboard XR Plugin 1.12.0;
- Native Camera 1.3.2.
Fixes:
- Rendering of Gaze-based Reticle Pointer: change Image component to TextMesh Pro.
2.1:
- Google Cardboard XR Plugin 1.4.1 with OpenGLES3 (instead of OpenGLES2);
- Native Camera 1.2.7;
- Debug Logging of Gaze-based Reticle Pointer: off by default.
2.0:
- Unity 2019.4.10;
- Google Cardboard XR Plugin 1.2.0 (former Google VR SDK).
Hi there! Can I use this with Vuforia Engine?
Hi, it works only with Google Cardboard XR Plugin.