0我正在从服务器 url 加载 3d 模型并使用资产包,但是当我在 unityeditor 中加载模型时,它工作正常,并且立方体的 3d 模型显示正确。但是当我在安卓手机中加载模型时,模型没有显示在屏幕上。
IEnumerator GetAssetBundle() {
string bundleURL = url;
Debug.Log (bundleURL);
using (WWW www = WWW .LoadFromCacheOrDownload(bundleURL, Version)) {
yield return www;
Debug.Log (Version);
if (www .error != null)
throw new UnityException("WWW Download had an error: " + www .error);
AssetBundle bundle = www .assetBundle;
if (AssetName == "") {
Debug.Log ("null");
mBundleInstance = Instantiate (bundle.mainAsset) as GameObject;
mBundleInstance.transform.parent = imageTarget.transform;
mBundleInstance.transform.localPosition = new Vector3(0,0,0);
}
else {
Debug.Log ("not null");
mBundleInstance = Instantiate(bundle.Load (AssetName)) as GameObject;
}
}
}
适用于 iOS、Android 和 PC 的资产包不是一回事。您应该根据您正在使用的平台构建这些。
这是为不同平台制作不同资产包的脚本。
此外,您还应该知道您需要Unity PRO才能使用资源包。