Download and Setup
Note: We recommend removing any previously-imported versions of the OSP or ONSP before importing a new plugin. See Updating to Oculus Native Spatializer for Unity from previous OSP for Unity Versions below for instructions.
To download the ONSP and import it into a Unity project:
- Download the Oculus Spatializer Unity package from the Audio Packages page.
- Extract the zip.
- Open your project in the Unity Editor, or create a new project.
- Select Assets > Import Package > Custom Package….
- Select OculusNativeSpatializer.unitypackage and import.
- When the Importing Package dialog opens, leave all assets selected and click Import.
To turn on the Native Spatializer:
- Go to Edit > Project Settings > Audio in Unity Editor
- Select OculusSpatializer in the Spatializer Plugin drop-down setting in the AudioManager Inspector panel as shown below.
We recommend Rift developers set DSP Buffer Size to Best latency to set up the minimum buffer size for the platform that is supported, reducing overall audio latency.
Gear VR developers should set DSP Buffer Size to Good or Default to avoid audio distortion.
Updating to Oculus Native Spatializer for Unity from previous OSP for Unity Versions
- Note the settings used in OSPManager in your project.
- Replace OSPAudioSource.cs (from previous OSP) on AudioSources with ONSPAudioSource.cs in <project>/Assets/OSP.
- Set the appropriate values previously used in OSPManager in the plugin effect found on the mixer channel. Note that the native plugin adds functionality, so you will need to adjust to this new set of parameters.
- Remove OSPManager from the project by deleting OSPManager*.* from <project>/Assets/OSP except your newly-added ONSPAudioSource.cs.
- Verify that OculusSpatializer is set in the Audio Manager and that Spatialization is enabled for that voice.
Use the functions on AudioSource to start, stop and modify sounds as required.
Note: To instantiate a GameObject which includes both ONSPAudioSource.cs and AudioSource components, you must call the function void SetParameters(ref AudioSource source)(found within ONSPAudioSource) on the AudioSource component before you call the AudioSource Play() function. This will explicitly set the AudioSource parameters before the audio stream is handled. If you skip this step, the parameters will not be immediately set, and you may hear a slight ‘jump’ at the start of playback.