(2) GearVR Development and Application Getting Started Tutorial: Creating a Unity Project

According to (1), after all the preparations are done, you can start this step and create a Uinty project.

The main process is as follows:
  • Create a Unity project (the Unity version of the blogger here is 5.6.2f1)
  • Set BuildSettings, release version parameters
  • importOculus.unitypackage 
  • Open the test demo in the Unity integration package
  • Download the Oculus signature file
  • Create apk signature file
  • Build apk
1》Create a new Unity project
a. Run Unity, in the Project Wizard dialog box, click the NEW button
b. Enter your project name, select the project storage directory, and click the Create project button


 
2"Set BuildSettings, release version parameters
a. In the menu bar, select File-BuildSettings...
b. In the BuildSettings window, change Platform to android, and change Texture Compression to ETC2 (GLES 3.0).
c. In Scenes In Build, select the scene you want to include in the package.


 
d. Click Player Settings... in Build Settings, and in the properties panel, set as follows,
e. Under Other Settings, be sure to check Virtual Reality Supported, then click the + button in SDKs to add Cardboard.
(During development, this place is very frustrating. If you don’t choose to type out the apk, it can’t be started on Gear, and Oculus seems to need to register a developer account before you can develop. So if you only add Oculus here, and don’t register an Oculus account, type The apk that comes out is also unusable.)

f. Modify the following settings:
·Company Name: Enter your company name
·Product Name: projName
·Default Icon: Icon (/Assets/ Workshop/Textures/Icon.png)
g. Expand the Other Settings section and change the BundleIdentifier to com.[yourComanyName].projName.
3》Import the Oculus Unity integration package
You need to download the oculus plugin for Unity5 
https://developer3.oculus.com/downloads/
Under the Project panel, right-click and select Import Package > custom Package to find you and download Oculus.unitypackage, then click Import


 
4"Run Test Demo
After importing, under the Project panel, Oculus > VR > Scenes is the built-in Demo project, you can double-click to open it to see the effect.


 
5》Download the Oculus signature file
Oculus requires that all apps that access VR functionality use a unique signature file created with a unique device ID. This signature file will call the underlying functions of the device through the API in the Oculus Mobile SDK.
A. On the mobile device, open the Device Id Fetch application. This app can show your device ID
Note: You can also refer to the first issue of this tutorial to manually obtain the device ID
B. Go to the https://developer.oculus.com/osig/ page and log in to your Oculus account. If you don't have an account yet, you can register for one.
C. After the account is logged in, paste the device ID into the input box of the form, and click the DOWNLOAD FILE button. Download your signature file and keep it somewhere handy.
D. In File Explorer, find the directory where the signature file is located.
E. Return to Unity. In the Project window, open the /Assets/Plugins/Android/assets folder, and drag the Oculus signature file into the folder.
6"Create apk signature file
a. Menu bar File>BuildSettings>PlayerSettings, find the right property panel [Inspector], Publishing Settings option.
b. Select Create a new keystore, then click Browse Keystore to select the directory to save the signature file (the default is in the root directory of the project, user.keystroe, you can also modify the name and path, I put it in the root directory here) Click Save and go back to Unity.
c. Enter the keystore password password and Confirm,.. Confirm the password 

d. Then click the drop-down list behind Alias ​​in the Key attribute below, and select Create a new key


 
e. The first data alias name, the second input password (the new password can be the same as the above key or not), the third confirmation password (here the test is all 123456), and then click Create Key

f. Back to Unity, in the Alias ​​drop-down list under the Key property, there is the Alias ​​we just created, then select it and enter the password.


 
7》Build APK
a. Go back to Unity. From the menu select File > Build Settings...
b. In the Build Settings window, click the Add Current button to add the scene you want to package to the Scenes In Build list.
c. In the Android setting item, confirm that Texture Compression is set to ETC2 (GLES 3.0).
d. Click the Build button.
e. In the Build Android dialog, give your APK file a name and click Save. During the APP creation process, you may be asked to specify the location of the Android SDK root folder and the location of the JDK on your computer.
f. After the creation is successful, Unity will automatically pop up the directory where the build apk file is located.
If there is no problem here, you can build a version and put it on your Gear to see if your Gear can run.

Guess you like

Origin blog.csdn.net/u013774978/article/details/130001741