I'm trying to test some AssetBundles for the game that I'm currently working on. I want to use this because I don't want the game to take a lot of space. I still don't know how servers work and how to upload them over there. I was searching on how to do this and found some neat stuff over here: AssetBundle (DLC) data load to Android phone at runtime [UNITY] But it tells something about uploading to a server and stuff, but I want to test it locally. Any recommendation?
Following what Remy told me, my code looks like this:
public class LoadFromFileExample : MonoBehaviour {
// Use this for initialization
void Start () {
string fileName = "planes";
var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, fileName));
if (myLoadedAssetBundle == null)
{
Debug.Log("Failed to load AssetBundle!");
return;
}
var prefab = myLoadedAssetBundle.LoadAsset< GameObject > ("andy");
Instantiate(prefab);
myLoadedAssetBundle.Unload(false);
}
// Update is called once per frame
void Update () {
}
}
But it shows the following error: Unable to open archive file: C:/Users/Chris/Desktop/myDLC/Assets/StreamingAssets/myassetBundle