Skip to main content
 首页 » 资源教程


2016年09月17日 16:42:141300

Using Spatial Audio

To get started with Google VR's spatial audio support in Unity, first add the first add theGvrAudioListener component to the same GameObject that Unity's AudioListener component is attached to. In most cases this will be the Main Camera.


When you hit Play in the Editor, GvrAudioListener initializes the Google VR Audio system automatically.


Note: For Unity 5.2+ users, you must select Gvr Audio Spatializer as the Spatializer Plugin in the Edit > Project Settings > Audio : Spatializer Plugin dropdown menu. This step is not required for users with Unity 5.1 or earlier.

注意:对于统一5.2 +用户,您必须选择Gvr音频声场定位技术的声场定位技术插件编辑>项目设置>音频:声场定位技术插件下拉菜单。这一步不需要用户提供统一5.1或更早。

Adding sources with Google VR Audio support

To add an audio source with Google VR Audio support, attach a GvrAudioSource component to a GameObject. Then, you can modify the properties of the source in similar way to Unitys AudioSource and press Play to hear the outcome immediately over headphones.

You can also add the GvrAudioSource prefab provided in the plugin package directly to your scene. This will add a GameObject with a generic GvrAudioSource attached to it.


添加一个音频源与谷歌VR音频支持,附上GvrAudioSource GameObject组件。然后,您可以修改源的属性相似的方式统一的AudioSource和媒体发挥听到结果立即在耳机。    


Adding room effects

The Google VR Audio system offers a sophisticated yet easy-to-use room simulation component to enhance the VR experience. In order to add a room to your project, add the GvrAudioRoom prefab to your scene. It consists of a GameObject with a generic GvrAudioRoom component attached to it.

You can also attach a GvrAudioRoom component manually to any GameObject you wish to use. To do so, select the GameObject in the Hierarchy panel, and select Add Component > Google VR > GvrAudioRoom in the Inspector panel. This component automatically takes the Transform properties of the GameObject set in the Inspector panel and simulates environmental effects accordingly. You can also adjust additional room properties to get the correct sound from a room. The GvrAudioRoom interface allows you to select surface materials which affect the sound in the scene according to their physical properties, alongside reflectivity and reverberation settings to fine tune the desired environment.

GvrAudioRoom applies the corresponding environmental effects whenever the GvrAudioListener components GameObject is inside the boundaries of the room. A yellow rectangular box Gizmo shows the adjusted boundaries of the room in the Scene view.


您还可以将手动GvrAudioRoom组件附加到任何GameObject你想使用。为此,选择层次结构中的GameObject面板,并选择Add组件>谷歌VR > GvrAudioRoom检查员面板。这个组件自动将转换的属性GameObject监视器面板中设置和模拟相应的环境影响。您还可以调整额外的空间属性,得到正确的声音从一个房间。GvrAudioRoom接口允许您选择表面材料影响声音场景中根据他们的物理性质,与反射率和混响设置调整所需的环境。


Integrating Google VR Audio with an existing project

Follow the guidelines in this document.

Replace each existing AudioSource in your scene with GvrAudioSource using the Hierarchy and Inspector panels. Modify the source properties accordingly. For scripts, renaming AudioSource to GvrAudioSource should be enough.


取代你的场景中每个现有AudioSource GvrAudioSource使用Hierarchyand检查员面板。相应地修改源属性。脚本,renamingAudioSource GvrAudioSource应该够了。

Note: Unity's own Reverb Zones are bypassed when you use Google VR Audio. The corresponding effect - with improved performance and realism - can be implemented by using a GvrAudioRoom.