Unity自动化打包工具

来源:互联网 发布:java中什么是工厂模式 编辑:程序博客网 时间:2024/06/04 18:18

项目寄存在Github,点击这里前往

本项目通过BuildMechine,编写自动化打包流程。可以实现一键打包功能。

使用方法和效果如下

Example

Custom Actions

public class BuildAction_CustomAction : BuildAction{    // 字段的数值会被保存     public string Msg;    // 属性的数值不会被保存。非常可能丢失    public string Msg {get; set;}    public BuildAction_CustomAction(string msg)    {        this.Msg = msg;    }    public override BuildState OnUpdate()    {        Debug.Log(Msg);        // 状态被设置成Success后,一下次tick会进入下一个任务        return BuildState.Success;        // 状态被设置成Failure后,一下次tick会结束任务队列        // return BuildState.Failure;    }    public override BuildProgress GetProgress()    {        // 返回空不现实进度条        return null;        // 返回具体参数现实进度条    }}

BatchModeExample

// cmd"x:\x\Unity.exe" -projectpath "x:\Project" -executeMethod BuildMechineExample.Build -batchmode

C#代码中使用BuildMechine.Run(true)而不是BuildMechine.Rune(false)

注意事项

  • 内部使用 UnityEngine.JsonUtility。如果自定义BuildAction里边使用Properties和JsonUtility不兼容的List或者Dictionary或者Array。会导致Action的数据丢失。
原创粉丝点击