Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 3.41 KB

cardboard.md

File metadata and controls

69 lines (48 loc) · 3.41 KB

Google Cardboard

Google Cardboard is an inexpensive handheld device that powers a virtual reality (VR) experience using almost any smartphone running Cardboard-enabled apps and it is compatible with Unity and HISPlayer.

Before continuing, please, complete the HISPlayer QuickStart Guide.

Minimum Unity version:

  • Unity 2021.3.32f1

Install Google Cardboard in Unity

Please, follow these steps to install the Google Cardboard package in your Unity project:

  1. Open Window > Package Manager
  2. Click on '+' icon and select Add package from git URL
  3. Paste https://github.com/googlevr/cardboard-xr-plugin.git in the input field
  4. Wait until the package is imported
  5. In the sample section you can import a simple sample for the Google Cardboard. The elements for the sample will be downloaded in Assets/Samples/Google Cardboard//Hello Cardboard.

Please, refer to the official Quickstart for Google Cardboard for Unity for more information.

Set up Google Cardboard with HISPlayer

Once the 1.2 configured HISPlayer SDK for Android is done, the following 2 files will be generated:

  • Assets\Plugins\Android\gradleTemplate.properties
  • Assets\Plugins\Android\mainTemplate.gradle

You need to add these dependencies following the official google cardboard guide : Quickstart for Google Cardboard for Unity

  1. Add the following lines to the dependencies section of Assets/Plugins/Android/mainTemplate.gradle:
  • implementation 'androidx.appcompat:appcompat:1.4.2'
  • implementation 'com.google.android.gms:play-services-vision:20.1.3'
  • implementation 'com.google.android.material:material:1.6.1'
  • implementation 'com.google.protobuf:protobuf-javalite:3.19.4'
  1. Add the following lines to Assets/Plugins/Android/gradleTemplate.properties:
  • android.enableJetifier=true
  • android.useAndroidX=true

You can also download the updated files from below links. Please, copy these files to your Assets\Plugins\Android replacing the old files:

After updating the files and rebuilding your project, if you have this error unity java.nio.file.AccessDeniedException you will need to clean the .gradle cache. Or you can simply follow these steps:

  • Close your Unity project
  • Remove Library folder from your Unity root project : yourProject/Library
  • Re-open your Unity project. This will re-generate the Library folder.
  • Build and Run

Please, ignore the error message that appears in the HISPlayer Settings window after the files gradleTemplate.properties and mainTemplate.gradle are modified.