Hi,
I’m new to using unity and javascript so please bear with me.
I’m triggering a download of an asset bundle (which only contains a sphere prefab) which I think is working fine. I created the asset bundle by using the Export Resource editor script and uploaded it to a server. I’m simply trying to load the sphere into my scene as the player is moving around to test the use of asset bundles. This is what is causing me problems.
I have the following code:
var download : WWW;
var url = "someServer";
private var assetBundle : AssetBundle;
function OnTriggerEnter(){
var download = WWW(url);
yield download;
Debug.Log("Asset downloaded.");
assetBundle = download.assetBundle;
assetBundle.Unload(true);
}
I get the following errors:
Failed to load asset bundle
UnityEngine.WWW:get_assetBundle()
NullReferenceException
Can anyone please help?