sceneManager.loadscene加載場景時不會主動去加載場景的依賴包,要手動加載或添加場景到build setting列表中


假設有一場景1001.unity,,manifest文件如下:

ManifestFileVersion: 0
CRC: 425184873
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: cd79999108bfb0a6a2695b1a33471bb4
TypeTreeHash:
serializedVersion: 2
Hash: 31d6cfe0d16ae931b73c59d7e0c089c0
HashAppended: 0
ClassTypes: []
Assets:
- Assets/res/Scenes/1001/1001.unity
Dependencies:
- F:/ProjectMobile/project/Assets/../debug/android/resource/assets/res/prefabs/effects/e_char/fazhen.assetbundle
- F:/ProjectMobile/project/Assets/../debug/android/resource/assets/res/prefabs/effects/e_scene/e_m001_shuizhengqi1.assetbundle
- F:/ProjectMobile/project/Assets/../debug/android/resource/assets/res/prefabs/effects/e_scene/e_m001_guangshu01/e_m001_guangshu01.assetbundle
- F:/ProjectMobile/project/Assets/../debug/android/resource/assets/res/prefabs/effects/e_scene/e_m001_taohuaban01/e_m001_taohuaban01.assetbundle
- F:/ProjectMobile/project/Assets/../debug/android/resource/assets/res/map/jiangnan.assetbundle

 

打包時,1001.unity打成了 1001.ab, 上面的依賴資源打成了 1001res.ab。

則直接scenemanager.loadscene(1001)會提示出錯:

scene '1001' couldn't be loaded because it has not been added to the build settings or the assetbundle has not been loaded.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM