- Home /
Question by
raj231 · Feb 23, 2015 at 07:49 AM ·
gameobjectaudioassetbundleaudiosource
How to play sound while animation load using assetbundle
I'm loading animation from server using assetbundle and i want to play sound for this animation. In the 3ds Max everything working fine and the audio also playing with animation. Then developer given a fbx file and mp3 sound file. I imported into unity and done for the Assetbundle and uploaded the assetbundle to server. Then load into scene the animation is working but the audio is not working. What i missed here?
// example URL of file on Android device SD-card
string bundleURL = AssetModelString;
using (WWW www = WWW .LoadFromCacheOrDownload(bundleURL, Version)) {
yield return www;
Debug.Log (Version);
if (www .error != null)
throw new UnityException("WWW Download had an error: " + www .error);
AssetBundle bundle = www .assetBundle;
if (AssetName == "") {
Debug.Log ("null");
mBundleInstance = Instantiate (bundle.mainAsset) as GameObject;
mBundleInstance.transform.localPosition = new Vector3(-0.2f, 0.0f, 0.0f);
mBundleInstance.transform.gameObject.SetActive(true);
}
Comment