Hi guys,
i’m pretty new to unity.
I have a few big landscape scenes (all in different projects) i’d like to load these dynamically in one unity game (pc/mac).
I created seperate assetBundles from them.
So in my first landscape scene when u enter a door, it loads another scene.
The script in the bottom is attached to that door.
When i run it it gives the error:
“Level: ‘Ename_test.unity’ (-1) couldn’t be loaded because it had not been added to the build settings.”
I’ve been looking on this forum for hours, but nothing solved this, although a lot of the same topics
Anyone knows a solution? thanks!
code:
using System;
using UnityEngine;
using System.Collections;
public class CachingLoadExample : MonoBehaviour {
public string BundleURL;
public string AssetName;
public int version;
void OnTriggerEnter(Collider other)
{
StartCoroutine (DownloadAndCache());
}
IEnumerator DownloadAndCache (){
// Wait for the Caching system to be ready
while (!Caching.ready)
yield return null;
// Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
using(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){
yield return www;
if (www.error != null)
throw new Exception("WWW download had an error:" + www.error);
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
Application.LoadLevel(AssetName);
}
}
}