zoukankan      html  css  js  c++  java
  • Unity 5 官方打包管理工具 Asset Bundle Manager

    http://blog.csdn.net/suifcd/article/details/51570003

    Unity5在Asset bundle 打包管理上采用了全新的方式,不需要再对每个文件进行MD5比对,unity已经帮我们做好了,对需要打包的资源AssetBundle属性就行了,同事Unity还提供了一个打包管理工具 Asset Bundle Manager。

    官方文档对这个工具的说明及使用方式,地址 
    官方的工具项目工程地址

    说下使用方式,工具提供了一键打包,本地加载模拟,网络加载模拟。

    打包很简单,设定好属性,直接打包就行。本地加载模拟,右键选择Simulation mode即可切换到此模式进行测试。

    还有一个是本地网络加载模拟,在本地搭建一个资源服务器,客户端连接这个服务器来进行动态的加载资源,但是实际测试中发现会报错,经过修改,终于好了。 
    首先需要在BuildScript.cs里修改变量为

    public static string overloadedDevelopmentServerURL = "http://192.168.1.101:7888/";

    具体的IP要根据自己的电脑来设定 
    然后修改LaunchAssetBundleServer.cs文件,主要是Run()函数,修改后的Run函数如下

    static void Run ()
            {
                string pathToAssetServer = Path.Combine(Application.dataPath, "AssetBundleManager/Editor/AssetBundleServer.exe");
                string pathToApp = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'));
                pathToAssetServer = pathToAssetServer.Replace("/", "\");
                pathToApp = pathToApp.Replace("/", "\");
                KillRunningAssetBundleServer();
    
                BuildScript.WriteServerURL();
    
                string args = Path.Combine(pathToApp, "AssetBundles");
                ProcessStartInfo startInfo = new ProcessStartInfo(pathToAssetServer); ;
                startInfo.Arguments = args;
                Process launchProcess = Process.Start(startInfo);
    
                if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0)
                {
                    //Unable to start process
                    UnityEngine.Debug.LogError ("Unable Start AssetBundleServer process");
                }
                else
                {
                    //We seem to have launched, let's save the PID
                    instance.m_ServerPID = launchProcess.Id;
                }
            }

    如此便可正常使用了。

    项目工程里有资源场景的加载示例,有兴趣的可以自行研究。

  • 相关阅读:
    HTTP的KeepAlive是开启还是关闭?
    JS中关于in运算符的问题
    关于jQuery的inArray 方法介绍
    JS中括号的用法
    关于js中for in的缺陷浅析
    Ajax datatype:'JSON'的error问题Status1:200,JSON格式
    windows 如何查看端口占用情况?
    确认过眼神,看清 HTTP 协议
    高考完?入门级的开源项目带你开启编程之旅
    MongoDB入门系列(四):权限管理
  • 原文地址:https://www.cnblogs.com/alps/p/7929451.html
Copyright © 2011-2022 走看看