unity 5 Assetbundle 打包 scene 工具
2016-09-21 17:44
543 查看
这段时间项目用到场景的动态加载,网上一查有挺多的,但很杂乱。有的版本太老,有的功能太少。
所谓自己动手丰衣足食。然后就自己写了一个能打包多平台的小工具。
可以打包多平台。在unity5.4上面亲测可行,有时候打包完会出一个错误,那个没关系,不影响使用,应该是写工具的时候哪里没写好。如果你发现了,麻烦你帮我指出来喽。
废话不多说。
还需要加载的话。都在这里快来拿吧。
链接:http://pan.baidu.com/s/1nvrpcE1 密码:js8a
所谓自己动手丰衣足食。然后就自己写了一个能打包多平台的小工具。
可以打包多平台。在unity5.4上面亲测可行,有时候打包完会出一个错误,那个没关系,不影响使用,应该是写工具的时候哪里没写好。如果你发现了,麻烦你帮我指出来喽。
废话不多说。
using UnityEngine; using UnityEditor; using System.IO; /// <summary> /// 脚本位置:Editor文件夹下 /// 脚本功能:打包scenes /// </summary> public class BuildAssetBundleScene : EditorWindow { private Scenesbuild msb; // 打包unity场景文件 [MenuItem("Assets/Build AssetBundle Scene")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(BuildAssetBundleScene), true, " 场景打包"); } void OnGUI() { EditorGUILayout.BeginVertical(); GUILayout.Label("平台选择", EditorStyles.boldLabel); msb = (Scenesbuild)EditorGUILayout.EnumPopup(msb); GUILayout.Label("打包", EditorStyles.boldLabel); if (GUILayout.Button("打包", EditorStyles.miniButton)) { BuildScenes(); } EditorGUILayout.EndVertical(); } public enum Scenesbuild { Window, Ios, Android, Window64, } void BuildScenes() { BuildTarget mtarget; string filepath; switch (msb) { case Scenesbuild.Android: mtarget = BuildTarget.Android; filepath = "/Android"; break; case Scenesbuild.Ios: mtarget = BuildTarget.iOS; filepath = "/Ios"; break; case Scenesbuild.Window: mtarget = BuildTarget.StandaloneWindows; filepath = "/Window"; break; case Scenesbuild.Window64: mtarget = BuildTarget.StandaloneWindows64; filepath = "/Window64"; break; default: mtarget = BuildTarget.StandaloneWindows64; filepath = "/Window64"; break; } // 需要打包的场景名字 string scenename = Application.loadedLevelName; string[] levels = { "Assets/" + scenename + ".unity" }; string out_path = Application.dataPath + "/unity3d"+filepath; if (!Directory.Exists(out_path)) { Directory.CreateDirectory(out_path); } BuildPipeline.BuildPlayer(levels,out_path+"/" + scenename + ".unity3d", mtarget, BuildOptions.BuildAdditionalStreamedScenes); // 刷新,可以直接在Unity工程中看见打包后的文件 AssetDatabase.Refresh(); } }
还需要加载的话。都在这里快来拿吧。
链接:http://pan.baidu.com/s/1nvrpcE1 密码:js8a
相关文章推荐
- Unity 游戏框架搭建 (十一) 简易AssetBundle打包工具(一)
- Unity 5 官方打包管理工具 Asset Bundle Manager
- Unity之AssetBundle自动打包工具
- Unity 5 官方打包管理工具 Asset Bundle Manager
- Unity 游戏框架搭建 (十二) 简易AssetBundle打包工具(二)
- Unity 游戏框架搭建 (十二) 简易AssetBundle打包工具(二)
- Unity 游戏框架搭建 (十一) 简易AssetBundle打包工具(一)
- Unity 游戏框架搭建 (十二) 简易AssetBundle打包工具(二)
- 项目记录05--客unity,服erlang--另外一种AssetBundle打包方式
- 浅尝Unity 3D的Asset Bundle知识(二)-----打包基础篇
- Unity 资源打包Assetbundle
- 【Unity】Unity5版本的AssetBundle打包方案之打包Scene场景
- Unity打包内部prefab和读取外部assetbundle的方法详解。
- [Unity基础]打包与读取AssetBundle
- 【Unity】资源打包Assetbundle
- unityassetbundle 打包存放百度云加载
- 小试Unity中OBJ和Scene打包Bundle与加载--wondows平台下
- Unity5 Sprite 图集打包 AssetBundle 更新探索
- 【Unity】AssetBundle 资源打包和依赖资源打包
- Unity AssetBundle打包与资源更新