0

0 サーバー URL から 3D モデルをロードし、assetbundle を使用していますが、モデルを unityeditor にロードすると正常に動作し、キューブの 3D モデルが適切に表示されます。しかし、Android モバイルでモデルをロードすると、モデルが画面に表示されません。

 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;
             }
         }
     }
4

1 に答える 1

1

iOS、Android、および PC のアセット バンドルは同じものではありません。使用しているプラ​​ットフォームに関してそれらを構築する必要があります。

プラットフォームごとに異なるアセット バンドルを作成するスクリプトを次に示します。

また、アセット バンドルを使用するには Unity PRO が必要であることも知っておく必要があります。

于 2015-01-30T11:19:16.900 に答える