Unity资源加载方式总结


1、Resource.load(string path)
优点:同步,使用方便
缺点:只能加载Resource目录下的资源

2、WWW
优点:灵活,可以加载Application.streamingAssetsPath、Application.persistentDataPath目录下的资源,以及从网络上下载资源
缺点:异步,如果业务需要按需加载资源,容易打散逻辑

3、AssetBundle.CreateFromFile(string path)
优点:同步,可以加载Application.persistentDataPath目录下的AssetBundle
缺点:AssetBundle不能压缩,在Android下不能加载Application.streamingAssetsPath下的AssetBundle

4、AssetBundle.CreateFromMemoryImmediate(byte[] binary)
优点:同步,可以加载Application.persistentDataPath目录下压缩过的AssetBundle
缺点:在Android下不能加载Application.streamingAssetsPath下的AssetBundle


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM