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\WebGLTemplates
withWebGLTemplates
from this repository.
-
Mac users: Copy the
WebGLTemplates
into yourAssets
folder.
Set build platform to WebGL
From File > Build Settings
, select WebGL
as the platform.
Set WebGL template
- Open
Edit > Project Settings > Player
to access thePlayer
settings. - Under
Resolution and Presentation
, selectWebVR
as your WebGL template.
Set up WebVR camera
- Copy
WebVRCameraSet.prefab
from theWebVRAssets/prefabs
folder into yourAssets
. - Replace your default
Main Camera
with theWebVRCameraSet
prefab. - Copy
WebVRAssets/Scripts/StereoCamera.cs
into yourAssets
, and ensure that it is attached to the parent node of the prefab.
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