官术网_书友最值得收藏!

Google Daydream

To build for Google Daydream on mobile Android devices, you will use the Daydream SDK. You must set up your development machine for Android development as described above. Then complete the following steps:

  1. Configure your Unity Build Settings to target the Android platform
  2. In Player Settings, under XR Settings, set Virtual Reality Enabled
  3. Ensure Daydream is at the top of the Virtual Reality SDKs list
  4. Download and Install the Google VR SDK package, as instructed previously

We will now build the MeMyselfEye camera rig for our scene. At the present time, the best example we have is the GVRDemo example scene provided with the Google VR SDK (can be found in the Assets/GoogleVR/Demos/Scenes/ folder):

  1. In your scene Hierarchy, create an empty game object under the MeMyselfEye (select the MeMyselfEye object, right-click, select Create Empty). Name it MyGvrRig.
  2. Set its height to 1.6 by setting its Transform to Position to (0, 1.6, 0).
  3. From the Project folders, locate the provided prefabs (Assets/GoogleVR/Prefabs).
  4. Drag a copy of each of the following prefabs from the Project folder to Hierarchy as a child of MyGvrRig:
    • Headset/GvrHeadset
    • Controllers/GvrControllerMain
    • EventSystem/GvrEventSystem
    • GvrEditorEmulator
    • GvrInstantPreviewMain
  5. Leave the Main Camera object under MeMyselfEye and enable it. The GoogleVR uses the existing Main Camera object.
  6. Save the prefab by selecting MeMyselfEye in Hierarchy, then press its Apply button in the Inspector.

The GvrHeadset is a VR camera properties manager. The GvrControllerMain provides support for the Daydream 3DOF hand controller. We will use GvrEventSystem in later chapters; it provides a drop-in replacement for Unity's Event System object. The GvrEditorEmulator is not actually part of your app but enables previewing your scene in the Unity Editor when you press Play. Likewise, adding GvrInstantPreviewMain lets you preview your app on your phone when you press Play in the editor.

These are the prefabs that we know we’re going to want to use. Certainly, go ahead and explore the other prefabs provided in the SDK. See https://developers.google.com/vr/unity/reference/.

We also recommend you take a look at Google Daydream Elements which provides additional demos and scripts "for developing high-quality VR experiences." We introduce this in the next chapter. See https://developers.google.com/vr/elements/overview.

When you’re ready, you can build your game as a separate executable app using the following steps:

  1. From the main menu bar, navigate to File | Build Settings....
  2. If the current scene is not already in the Scenes to Build list, press Add Open Scenes.
  3. Click on Build and Run and set its name to Diorama.
  4. I like to keep my builds in a subdirectory named Build; create one if you want to.
  5. Click on Save.

An Android APK file will be created in your Build folder and uploaded to your attached Android phone.

主站蜘蛛池模板: 呼和浩特市| 洛南县| 朝阳县| 镇坪县| 洪江市| 砚山县| 安图县| 兴海县| 桦川县| 威信县| 永福县| 合肥市| 荣成市| 枣庄市| 丰宁| 德庆县| 定兴县| 中阳县| 清水河县| 瓦房店市| 涞源县| 元谋县| 沂水县| 阜平县| 奎屯市| 扶绥县| 永州市| 奉节县| 繁昌县| 阿克陶县| 昌邑市| 嘉峪关市| 四会市| 遵义市| 静海县| 乌拉特后旗| 万盛区| 通渭县| 土默特右旗| 长兴县| 鸡泽县|