当前位置:首页 > 编程开发

unity打包批处理备份

webgou9年前 (2017-11-11)编程开发261

Builder.cs

using UnityEngine;

using UnityEditor;

using System.Collections;

using System.Collections.Generic;

 

public class Builder : Editor

{

    static public void Build()

    {

        string outputPath = Application.dataPath.Substring(0, Application.dataPath.Length - "Assets".Length) + "_Out/";

        BuildOptions buildOption = BuildOptions.AcceptExternalModificationsToPlayer;

        string[] ss = System.Environment.GetCommandLineArgs();

        for (int i = 0; i < ss.Length; i++)

        {

            if (ss[i] == "-outputPath")

            {

                outputPath = ss[i + 1];

            }

        }

        outputPath = outputPath.Replace('\\', '/');

        BuildPipeline.BuildPlayer(GetBuildScenes(), outputPath, BuildTarget.Android, buildOption);

    }

    static string[] GetBuildScenes()

    {

        List<string> pathList = new List<string>();

        foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes)

        {

            if (scene.enabled)

            {

                pathList.Add(scene.path);

            }

        }

        return pathList.ToArray();

    }

}

 

----

suball.bat

call build.bat

cd..

call rename.bat

-----

rename.bat

del MainActivity-release-unsigned.apk 

copy .\app\bin\MainActivity-release-unsigned.apk .\

if %time:~0,2% lss 10 (set d=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%)else (set d=%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%)

 

rename .\MainActivity-release-unsigned.apk GTS_%d%.apk 

copy GTS_%d%.apk \\192.168.8.190\共享目录\每日版本\sgz2018\185_%d%.apk

 

 

-----

clean.bat

cd app

ant clean 

--------

build_unity.bat

@echo off

 

set BUILD_BAT_PATH=%cd%

set UNITY_PATH="E:\Unity4.7.2\Editor\Unity.exe"

set UNITY_PROJECT_NAME=app

set UNITY_PROJECT_PATH=%cd%\..\..\

set EXPORT_PROJECT_PATH=%cd%\app

set EXPORT_PROJECT_PATH_OUTPUT=%cd%

set EXTRA_PROJECT_DATA=%cd%\data

set UNITY_METHOD_NAME=Builder.Build

set UNITY_LOG_PATH=%cd%\unity_log.txt

 

echo 步骤1:清理文件夹 

 

rem if exist %EXPORT_PROJECT_PATH% ( rd /s /q %EXPORT_PROJECT_PATH% )

 

 

echo 步骤2:调用UNITY 打包

%UNITY_PATH% -quit -batchmode -logFile %UNITY_LOG_PATH% -projectPath %UNITY_PROJECT_PATH% -executeMethod %UNITY_METHOD_NAME% -outputPath %EXPORT_PROJECT_PATH_OUTPUT%

 

------

build.bat

rd /s /q .\app\res

md .\app\res

xcopy .\res .\app\res /c/e/q

xcopy /y .\comm .\app /c/e/q/a

cd app

rem ant clean

ant release

rem copy .\bin\MainActivity-release.apk ..\

rem rename ..\MainActivity-release.apk test.apk 

rem cd ..

-----

all.bat --

call build_unity.bat

call clean.bat
cd ..
call build.bat
cd..
call rename.bat

扫描二维码推送至手机访问。

版权声明:本文由知了博客发布,如需转载请注明出处。

本文链接:https://www.webgou.info/?id=611

分享给朋友:

“unity打包批处理备份” 的相关文章

rpm 用法简介

rpm可谓是Redhat公司的一大贡献,它使Linux的软件安装工作变得更加简单容易。 1. 安装: 我只需简单的一句话,就可以说完。执行:rpm ivh rpm软件包名rpm参数 参数说明-i 安装软件-t 测试安装,不是真的安装-p 显示安装进度-f 忽略任何错误-U 升级安装-v 检测套件是否…

android ndk "5039: Operation timed out."解决办法

在调试C/C++代码时,需执行: 1.adb forward tcp:5039 tcp:5039 2.ndk-gdb-eclipse --force --start 参考: ndk-gdb关联eclipse设置方法 Using cgdb with ndk-debug (and cgdb tuto…

在 CentOS 7 下安装配置 shadowsocks

CentOS 7 开始默认使用Systemd作为开启启动脚本的管理工具,Shadowsocks则是当前比较受欢迎的科学上网工具,本文将介绍如何在 CentOS 下安装和配置 Shadowsocks 服务。...…

Windows下mysql忘记root密码的解决方法

 Windows下mysql忘记root密码的解决方法 …

DeepSeek-R1 本地部署指南:Ollama

 DeepSeek-R1 本地部署指南:Ollama...…

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。