interactive-app / Unity-WebVR-Assets

UnityでWebVRに対応したWebGLビルドを行うテンプレートおよびアセット

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity-WebVR-Assets

WebVR template and assets for creating WebVR-enabled Unity projects.

How to Use

Copy WebGL template

  • Windows users: Overwrite C:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport\BuildTools with WebGLTemplates.
  • Mac users: Copy the WebGLTemplates into your Assets folder.

Set build platform to WebGL

From File > Build Settings, select WebGL as the platform.

WebGL!

Set WebGL template

  1. Open Edit > Project Settings > Player to access the Player settings.
  2. Under Resolution and Presentation, select WebVR as your WebGL template.

Template!

Set up WebVR camera

  1. Copy WebVRCameraSet.prefab from the WebVRAssets/prefabs folder into your Assets.
  2. Replace your default Main Camera with the WebVRCameraSet prefab.
  3. Copy WebVRAssets/Scripts/StereoCamera.cs into your Assets, and ensure that it is attached to the parent node of the prefab.

Camera!

Build and run

Once your project finishes building, open the generated index.html in a WebVR-enabled browser.

Local Development Notes

To copy the files over to your project:

UNITY_WEBVR_PROJECT=$HOME'/my-project/' sync.sh

Japanese Instructions

UnityでWebVRに対応したWebGLビルドを行うテスト用のテンプレートおよびアセット

###使い方 WebGLTemplatesフォルダーを、

  • Windowsの場合 C:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport\BuildToolsのフォルダーに上書きします。
  • Macの場合 Assetsフォルダーにコピーします。

これで、Build Settings > WebGL > Player Settings > Publishing Settings > WebGL Template にWebVRというテンプレートが追加されます。

次にWebVRAssetsフォルダー内のPrefabフォルダーとScriptsフォルダーをAssetsフォルダにコピーします。 PrefabsフォルダーにはWebVRCameraSetというPrefabがありますので、このカメラを適当に配置し、WebVRCameraSetにScriptsフォルダー内にあるStereoCamera.csをアタッチします。

あとは、WebGLでWebVRテンプレートを使ってビルドを行い、出力されたindex.htmlにアクセスすればできます。

ライセンスはフリーです。自由に使ってください。

About

UnityでWebVRに対応したWebGLビルドを行うテンプレートおよびアセット


Languages

Language:JavaScript 49.6%Language:C# 28.3%Language:CSS 15.2%Language:HTML 5.8%Language:Shell 1.2%