- Home /
This question was
closed May 31, 2016 at 08:55 AM by
Prasanna for the following reason:
The question is answered, right answer was accepted
Question by
Prasanna · Jan 10, 2015 at 11:19 AM ·
sceneassetbundlescene-loadingdownloadloadfromcacheordownload
Not download/load from cache for second time
Hi all, Here i created a assetbundle for scene by scene. I its perfectly loaded the scene first time but it doesn't load or even download the assetbundle,
using UnityEngine;
using System.Collections;
public class Orbitrek_Elite : MonoBehaviour
{
private string progress = " ";
private string logtxt;
private string url = ;
GUIStyle Font_Size;
void Awake()
{
Font_Size = new GUIStyle ();
Font_Size.fontSize = 40;
Font_Size.normal.textColor = Color.black;
}
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 (560, 684, Screen.width - 5, Screen.height - 5), "Downloading: ", Font_Size);
GUI.Label (new Rect(795, 684, Screen.width - 5, Screen.height - 5), logtxt + " " + progress, Font_Size);
}
IEnumerator Start()
{
using(WWW www = WWW.LoadFromCacheOrDownload (url, 1))
{
while( !www.isDone )
{
progress = " " + (www.progress * 100.0f).ToString("#") + " %";
yield return null;
}
yield return www;
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
Application.LoadLevel("Orbit");
}
}
}
In this script i try to load the scene, but its working smoothly when i load all scene in one time.
Comment