- Home /
Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle.
hello..
I am loading gameobject from assets bundle on server. Code which i am using is here :
IEnumerator Start () {
string model = PlayerPrefs.GetString("LoadModel" , "GoblinBundle");
string url = "http://oceanstechnologies.com/service/emailcampaign/websites/tempr/unity/"+model;
// Start a download of the given URL
#if UNITY_ANDROID && !UNITY_EDITOR
url += ".android.unity3d";
#elif UNITY_IPHONE && !UNITY_EDITOR
url += ".iphone.unity3d";
#else
url += ".unity3d";
#endif
www = WWW.LoadFromCacheOrDownload(url, 1);
yield return www;
//Debug.Log("Loaded ");
if (www.error != null)
throw new Exception("WWW download had an error: " + www.error);
AssetBundle assetBundle = www.assetBundle;
skull = Instantiate(assetBundle.mainAsset) as GameObject; // Instantiate(assetBundle.Load("AssetName"));
skull.transform.position = new Vector3(0 , 0.0f , 15.0f)
skull.gameObject.SetActive(false);
}
I am getting my object loaded but on next scene i want same object to be loaded/use. when i write this code in next scene , i got this error.
So how can i use this same object in another scene .
Thanks..
Answer by Ekta-Mehta-D · Feb 25, 2015 at 06:03 AM
I solved by unloading it to false like
bundle.Unload(false);
Answer by A_never_kill · Feb 25, 2015 at 05:29 AM
HI,
Try Object.DontDestroyOnLoad.
Link : http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
Let me know if you have any concern.
Thanks Aman
0 The answer is waiting approval by a moderator. HI,
Try Object.DontDestroyOnLoad.
Link : http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
Let me know if you have any concern.
Thanks Aman
Your answer
Follow this Question
Related Questions
[AssetsBundle] How to keep an AssetBundle on device after the download 1 Answer
The AssetBundle can't be loaded because another AssetBundle with the same files is already loaded. 1 Answer
What is the best way to "update" my game without m2h patcher? 0 Answers
Android Plugin: Load assets from APK, but have low-level access to AssetManager. 0 Answers