How can I change the script to allow the end user to enter a URL, in the game view themselves, instead of me at the back end?
Here is the Unity script that I am using successfully to allow me add an asset bundle in the scene view at the back end:
using System;
using UnityEngine;
using System.Collections;
class NonCachingLoadExample : MonoBehaviour
{
public string BundleURL;
public string AssetName;
IEnumerator Start()
{
// Download the file from the URL. It will not be saved in the Cache
using (WWW www = new WWW(BundleURL))
{
yield return www;
if (www.error != null)
throw new Exception("WWW download had an error:" + www.error);
AssetBundle bundle = www.assetBundle;
if (AssetName == "")
Instantiate(bundle.mainAsset);
else
Instantiate(bundle.LoadAsset(AssetName));
// Unload the AssetBundles compressed contents to conserve memory
bundle.Unload(false);
}
// memory is freed from the web stream (www.Dispose() gets called implicitly)
}
}
It should look something like this: