Unity does not support endless ogg streams. If this happened to work in 2.5, then it was unintended - however, even there, it would probably cause trouble, as Unity would try to download the stream into memory, which would eventually make it run out of memory.
In 2.6, the audio engine has been replaced - we went from OpenAL to FMOD, which has probably resulted in this change. If support for ogg streams is important to you, I suggest you request it as a new feature on feedback.unity3d.com.
i came across the same problem, and after nearly 2 hours, i finally solved it. The reason is that you wanna to play the audio before its completely downloaded, you should call audio.Play function like this:
string bkgrdMusicPath = Application.dataPath + "/Rockburst_YC/Resources/bkgrdMusic.ogg";
_download = new WWW(bkgrdMusicPath);
while (_download.audioClip.isReadyToPlay == false)//NOTE:the while loop is very important!
{
yield return _download;
}
_bkgrdMusic = _download.GetAudioClip(false, false);
_bkgrdMusic.name = "downloadMusic";
if (_bkgrdMusic == null)
{
_bBkgrdMusicOn = false;
UnityEngine.Debug.Log("无法找到背景音乐, 请检查Rockburst_YC/Resources/文件夹下是否有bkgrdMusic.ogg音频文件!");
}
else
{
audio.clip = _bkgrdMusic;
audio.enabled = true;
audio.loop = true;
print(_bkgrdMusic.isReadyToPlay.ToString());
if (_bkgrdMusic.isReadyToPlay)
{
audio.Play();
}
}
And a wrong version like this:
string bkgrdMusicPath = Application.dataPath + "/Rockburst_YC/Resources/bkgrdMusic.ogg";
_download = new WWW(bkgrdMusicPath);
yield return _download;//No while loop at all! the audio may not be completely downloaded, that's the reason!
_bkgrdMusic = _download.GetAudioClip(false, false);
_bkgrdMusic.name = "downloadMusic";
if (_bkgrdMusic == null)
{
_bBkgrdMusicOn = false;
UnityEngine.Debug.Log("无法找到背景音乐, 请检查Rockburst_YC/Resources/文件夹下是否有bkgrdMusic.ogg音频文件!");
}
else
{
audio.clip = _bkgrdMusic;
audio.enabled = true;
audio.loop = true;
print(_bkgrdMusic.isReadyToPlay.ToString());
if (_bkgrdMusic.isReadyToPlay)
{
audio.Play();
}
}