Search Unity

Music playback starts, stops, then resumes

Discussion in 'Editor & General Support' started by Damocles, Jan 8, 2014.

  1. Damocles

    Damocles

    Joined:
    Jul 21, 2012
    Posts:
    46
    In my game, I start the background music playing, and it plays fine for about a second, then stops for about a second, then restarts and plays normally after that.

    I thought it was a streaming/buffering issue, so I tried adjusting the audio settings, and marked the clip as stream from disk. Still the problem remains.

    I tried adding code so that if AudioClip.isReadyToPlay is false, then it will wait and try again in a while. So it will only ever reach the call to .Play() when .isReadyToPlay is true. Still the problem remains.

    I discovered that if I tell it to wait a couple of seconds before playing the music, the playback is normal but I get a warning in the console: "Can not play a disabled audio source." Yet it plays just fine even with the warning.

    I would really prefer to have the music start as soon as the level loads - does anyone know what causes this or how to fix it?