{
The Debug Log (" ready to download AB ");
UnityWebRequest UnityWebRequest=UnityWebRequestAssetBundle. GetAssetBundle (url);
Yield return unityWebRequest. SendWebRequest ();
AssetBundle ab=DownloadHandlerAssetBundle. GetContent (unityWebRequest);
GameObject obj=ab. LoadAsset
Instantiate (obj);
The Debug Log (" download AB finish ");
}
CodePudding user response:
IEnumerator LoadGameObject (url string, the string objName)
{
The Debug Log (" ready to download AB ");
UnityWebRequest UnityWebRequest=UnityWebRequestAssetBundle. GetAssetBundle (url);
Yield return unityWebRequest. SendWebRequest ();
//save
System. IO. File. WriteAllBytes (" filename ", unityWebRequest. DownloadHandler. Data)
AssetBundle ab=DownloadHandlerAssetBundle. GetContent (unityWebRequest);
GameObject obj=ab. LoadAsset(objName);
Instantiate (obj);
The Debug Log (" download AB finish ");
}
CodePudding user response:
File. WriteAllBytes () method is an error: a NotSupportedException: Raw data access is not supported for asset bundles don't know is why?