- Home /
Found own way.
Asset Bundle Download Problem
Hello there, i have assetbundle for my project. Here my assetbundle is created fine, i can download that bundle from url at the same time i can download that link directly through browser and from my mobile too. am using android platform.
This is for creating AssetBundle, this works perfectly...
using UnityEngine;
using UnityEditor;
public class ExportAssetBundles
{
[MenuItem("Assets/Build AssetBundle")]
static void ExportResource ()
{
BuildPipeline.PushAssetDependencies();
string[] levels = {"E:/Unity Works/Projects/Unity Camera/Assets/Assets/Scenes/Camera.unity"};
string path= "E:/Unity Works/Assets_Bundle/Game_Play.unity3d";
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildStreamedSceneAssetBundle(levels,path, BuildTarget.Android);
BuildPipeline.PopAssetDependencies();
}
}
This is for download assetbundle from URl, the link is working perfect it's downloaded the file from server, i can see it in my folder. But it's not proceed the level to load...
using UnityEngine;
using System.Collections;
public class BundleLoad : MonoBehaviour
{
private string progress = " ";
private string logtxt;
public string url = "";
void log( string t )
{
logtxt += t + "\n";
}
void OnGUI()
{
Vector3 scale;
float ResolutionX = 1024;
float ResolutionY = 768;
scale.x = (float)Screen.width/ResolutionX;
scale.y = (float)Screen.height/ResolutionY;
scale.z = 1;
Matrix4x4 svMat = GUI.matrix;
GUI.matrix = Matrix4x4.TRS(new Vector3(0,0,0),Quaternion.identity,scale);
GUI.Label(new Rect(10, 10, Screen.width-10, Screen.height-10), logtxt + " " + progress);
}
IEnumerator Start()
{
using(WWW www = WWW.LoadFromCacheOrDownload (url, 1))
{
while( !www.isDone )
{
progress = Time.time + "-" + www.progress/100.0f;
yield return null;
}
yield return www;
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
Application.LoadLevel("Game_Play");
}
}
}
How can i finish this.
what is the error you are getting? If your problem is they arent updating it is because you need to clean the cache folder.
I didn't get any error, but i can't download from the server. Once i game clicked link its says failed download, i cleared all cache file in the browser.
Follow this Question
Related Questions
How get all scene and asset name from given bundle for Unity AssetBundleManager? 0 Answers
Asset bundle not load the object, but it download 0 Answers
asset bundle create and download from server(IOS) 1 Answer
Can't load asset bundles offline even if they are cached. 0 Answers
Cloud recognition in Vuforia 0 Answers