No audio is heard by the player during gameplay

Recently, I used Unity’s Polyspatial component and successfully developed a VisionOS application. It ran successfully in the VisionOS simulator and was submitted for review by the Apple Store. However, Apple’s response mentioned that during the runtime of my application, the player was unable to receive my audio, although I could hear my audio while running it in the simulator.

I wonder if there are any special settings needed for the audio listener in mixed reality apps. In my current scene, there is only one audio listener, and it is attached to the scene camera. It works fine in the simulator, but the official team at the Apple Store couldn’t hear it during the real device review. I am looking for a solution to this problem and eagerly await your reply!


3 Likes

Or perhaps it’s related to my 3D sound settings for background audio source?

Another thing worth mentioning is that when I exit the app by clicking the ‘X’ button at the bottom while running the simulator, my app’s background audio source continues to play and doesn’t stop when the app exits. I’m not sure if this is a bug in the simulator itself.

I’m using PolySpatial 1.1.4, changing the scene causes silence. If I open control center panel on vision pro (little dot at top of the screen) and close it, audio system starts to work as expected.

Any workaround?

1 Like

I recently encountered a similar issue as well. In my case, after opening the app with the Volume Camera set to Unbounded Mode, changing the scene to Bounded Mode does not produce any sound, and vice versa; opening the app in Bounded Mode and then changing the scene to Unbounded Mode also results in no sound.

For now, the only solution seems to be to keep the entire app consistent in either Bounded Mode or Unbounded Mode, but does anyone know a better workaround?

1 Like

I suggest you to use 1.0.3 version for PolySpatial package collection.

1 Like

Thank you. Reverting to version 1.0.3 of PolySpatial solved the issue with the sound not working. Actually, there are features in version 1.1.4 that we need, so we are hoping that this will be resolved in future versions.

2 Likes

Over in this thread, I noticed that the project shared in that user’s bug report had a different Volume Camera Window Configuration in the start-up scene from the one in Project Settings > PolySpatial > Default Volume Camera Window Config. This will result in the app starting up with a volume with one configuration (the one in Project Settings) and then immediately closing that and opening a new volume with the one specified in the volume camera for the start-up scene. You don’t actually notice this because the volumes animate in and out. As far as I can tell, this fixed the issues that user was seeing. This project is using PolySpatial 1.1.4.

Hello. I would like to share my situation in hopes that it might help others in the same boat.

I am building an app that switches between Bounded and Unbounded scenes, and I am encountering a similar issue. The audio works fine right after the build, but when I detach the app from Xcode and run it again, the sound does not play.

I was very interested in the solution suggested earlier, but unfortunately, it doesn’t fit my use case as it involves using something other than the default volume camera during scene transitions.

I also tried implementing this method, but the required settings are different for Bounded and Unbounded scenes (Bounded: Bypass, Unbounded: HeadTracked), which doesn’t suit my needs.

Additionally, I attempted to use this method to call Swift functions from Unity during scene transitions, but it didn’t work as expected. It seems the settings might be overwritten when executed. Following codes are samples of Swift functions:

// Declared in C# as: static extern void SetupSpatialAudioSessionBypass();
@_cdecl("SetupSpatialAudioSessionBypass")
func setupSpatialAudioSessionBypass()
{
    print("SETUP SPATIAL AUDIO BYPASS")
    do {
        let session = AVAudioSession.sharedInstance()
        try session.setIntendedSpatialExperience(.bypassed)
    } catch {
        fatalError("Failed to reconfigure active shared session.")
    }
}

// Declared in C# as: static extern void SetupSpatialAudioSessionHeadTracked();
@_cdecl("SetupSpatialAudioSessionHeadTracked")
func setupSpatialAudioSessionHeadTracked()
{
    print("SETUP SPATIAL AUDIO HEAD TRACKED")
    do {
        let session = AVAudioSession.sharedInstance()
        try session.setIntendedSpatialExperience(
            .headTracked(soundStageSize: .medium, anchoringStrategy: .front)
        )
    } catch {
        fatalError("Failed to reconfigure active shared session.")
    }
}

For reference, I am using PolySpatial 1.2.3.

I used Unity 2022.3.20f1 and PolySpatial 1.1.4. I met the same issue.
I solved this issue by upgrading each version to Unity 2022.3.30f1 and PolySpatial 1.2.3.