1、打AB包
ab包插件:assetbundles-browser-master.zip
1)编辑器修改
将此代码放到Editor文件夹下,不然会报错
using System.Net; using UnityEditor; using System.IO; using System; //-----------------------------【构建AssetBundles资源包】----------------------------- public class BuildAssetBundles { // 菜单选项目录 [MenuItem("Assets/Build AssetBundles")] static public void BuildAllAssetBundles() { // 创建文件目录 string dir = "AssetBundles"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } // 构建 // 参数1:路径 // 参数2:压缩算法,none 默认 // 参数3:设备参数,ios,Android,windows等等 BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64); UnityEngine.Debug.Log("AssetBundle资源打包完成!"); } }
然后在Assets菜单下会出现Build AssetBundles,如下:
2)设置
在场景中创建一个sphere,然后制作prefab。在预制体的Inspector面板中修改AssetBundle。
tips:new->输入名称(尽量英文,两个都要改,前一个是名称,后一个是后缀)
3)打包
这时候就完成了ab包打包设置,Assets->Build AssetsBundle即可完成打包,打包后输入文件在Assets文件同级下(先等下吼,因为还有一个文件哈)
ab包里有四个文件
2、服务器配置
使用的netbox服务器
1)下载和安装
nbsetup.rar
按照安装步骤一步步来即可,很快就安好了!!!
2)配置
第一步:在安装好的位置,新建一个文件夹,用做服务器,后续这个文件中的文件可以访问
第二步:在同级文件夹中新建一个txt,并且改名为main.box,然后用记事本打开,复制如下信息进去
Dim httpd Shell.Service.RunService "NBWeb", "NetBox Web Server", "NetBox Http Server Sample" '---------------------- Service Event --------------------- Sub OnServi