[This is the asset bundle][1]. It's just a rock from [Free Rocks][2]. Doesn't matter what asset bundle I try to make or where I host it, I always get the same error message, which suggests that I must be doing something wrong. Please help, thank you.
My code:
using System.Collections;
using System.Collections.Generic;
using System.Net;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
public class main : MonoBehaviour
{
public string bundleUrl;
public string assetName;
void Start() {
StartCoroutine(GetAssetBundle(bundleUrl));
}
// Update is called once per frame
void Update() {
}
IEnumerator GetAssetBundle(string bundleUrl) {
UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(bundleUrl);
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
} else {
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
GameObject prefab = bundle.LoadAsset(assetName);
Instantiate(prefab);
}
}
}
the editor:
[https://imgur.com/a/9MbDxgu][3]
I tried with .unity3d extension and without it.
[1]: https://down.uploadfiles.io/get/0o1r5
[2]: https://assetstore.unity.com/packages/3d/environments/landscapes/free-rocks-19288
[3]: https://imgur.com/a/9MbDxgu
↧