CS1061 error when installing google cardboard. Help please.
Hey guys I just installed unity on windows 10. I also followed the google cardboard sdk instructions to play their demo but I'm got this error when I tried playing it:
Assets/Cardboard/Scripts/Audio/CardboardAudioSource.cs(297,19): error CS1061: Type UnityEngine.AudioSource' does not contain a definition for
spatialize' and no extension method spatialize' of type
UnityEngine.AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets/Cardboard/Scripts/Audio/CardboardAudioSource.cs(287,21): error CS1061: Type UnityEngine.AudioSource' does not contain a definition for
SetSpatializerFloat' and no extension method SetSpatializerFloat' of type
UnityEngine.AudioSource' could be found (are you missing a using directive or an assembly reference?)
Here is what the code looks like:
/ Initializes the source. private bool InitializeSource () { if (id < 0) { id = CardboardAudio.CreateAudioSource(hrtfEnabled); if (id >= 0) { CardboardAudio.UpdateAudioSource(id, transform, bypassRoomEffects, gainDb, spread, rolloffMode, sourceMinDistance, sourceMaxDistance, directivityAlpha, directivitySharpness, currentOcclusion); audioSource.spatialize = true; audioSource.SetSpatializerFloat(0, id); } } return id >= 0; }
// Shuts down the source. private void ShutdownSource () { if (id >= 0) { audioSource.SetSpatializerFloat(0, -1.0f); audioSource.spatialize = false; CardboardAudio.DestroyAudioSource(id); id = -1; } }
Answer by dolims · May 19, 2016 at 04:17 AM
Cardboard requires Unity 5.2.1 or later, which has the new audio spatializer plugin system.