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
posted @ 2015-02-03 11:47  basenet855x  阅读(3467)  评论(0编辑  收藏  举报