我創建了簡單的Unity應用程序,允許加載從互聯網下載的不同場景。 如果場景不包含任何腳本,它會很好用。如果有一個與遊戲物體連接的腳本,它失敗,出現錯誤:通過Application.LoadLevel加載的場景中的腳本不起作用
The class defined in script file named 'XXX' does not match the file name!
如果場景開始作爲獨立的應用程序腳本工作沒有任何問題,但如果那一幕通過BuildPipeline.BuildStreamedSceneAssetBundle保存我得說明錯誤。
我通過簡單的代碼加載場景:
WWW www = new WWW("file://" + file);
yield return www;
loadedBundle = www.assetBundle;
Application.LoadLevel(name);
主要腳本停留在現場,因爲我叫DontDestroyOnLoad它。
我通過Unity3D 3.5.0檢查這種情況下和3.5.1
我哪裏錯了嗎?
非常感謝。
確定嗎? [documentation](http://docs.unity3d.com/Documentation/Manual/scriptsinassetbundles.html)表示,除了iOS(由於Apple限制),可以在捆綁包中包含腳本。 – 2014-01-14 16:44:32
我確定。您可以包含腳本,但只能作爲字節碼。檢查我的另一個問題:http://stackoverflow.com/questions/10808033/how-to-compile-unity3d-script-to-include-it-to-assetbundle – 2014-01-14 20:15:52