UnityWebRequestAssetBundle.GetAssetBundle not working on iOS
void LoadAssetFromBundle()
{
StartCoroutine(GetAssetBundle());
}
IEnumerator GetAssetBundle()
{
UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle("https://brain.rs/rkd/2/assetbundletestios");
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
myLoadedAssetBundle = bundle;
if (myLoadedAssetBundle != null)
{
Debug.Log("It's downloaded");
}
}
}
But it doesn't Debug and whenever I try to instantiate a prefab through this code it says that the Object reference is not set to an instance of an object.
If anyone can help me with this, I'd be extremely grateful!
↧