美文网首页Unity干货Unity3D与游戏开发征服Unity3d
四、Unity3d+Jenkins持续集成-Unity3D命令行

四、Unity3d+Jenkins持续集成-Unity3D命令行

作者: e29290bad2f3 | 来源:发表于2018-10-24 19:15 被阅读12次

    1.原理是使用Unity3d的命令行模式,可参考
    https://docs.unity3d.com/Manual/CommandLineArguments.html

    2.修改settings.properties,增加Unity运行路径

    app.version = 1.2.1
    unity.bin = /Applications/Unity/Unity.app/Contents/MacOS/Unity
    

    3.修改权限/Applications/Unity/Unity.app/Contents/MacOS/Unity为所有人拥有可读写权限


    image.png

    4.修改build.xml

         <target name="compile-android" depends="clean">
            <echo message="Compiling unity project for android version ${VERSION_STRING}"/>
            
            <echo message="${unity.bin} -projectPath ${env.WORKSPACE} -logFile  ${env.WORKSPACE}/ant_android_log.txt -buildTarget Android -executeMethod AutoEditor.BuildAndroidResource -batchmode -quit"/>
            <exec executable="${unity.bin}" failonerror="true">
                <arg line="-projectPath ${env.WORKSPACE}"/>
                <arg line="-logFile  ${env.WORKSPACE}/ant_android_log.txt"/>
                <arg line="-buildTarget Android" />
                <arg line="-executeMethod AutoEditor.BuildAndroidResource"/>
                <arg line="-batchmode"/>
                <arg line="-quit"/>
            </exec>
            
            <loadfile property="unity.build.log" srcFile="${env.WORKSPACE}/ant_android_log.txt"  encoding="UTF-8"/>
            <echo message="${unity.build.log}"/>
        </target>
    

    5.如果出现错误,使用Unity3D加载一个工作区的Unity3D工程,看是具体错误原因,本人碰到问题是Unity3D加载工作报只读权限错误,修改workspace为所有人拥有可读写权限


    image.png

    6.jenkins(詹金斯),控制台输出,调用Unity3D命令行模式成功

    相关文章

      网友评论

        本文标题:四、Unity3d+Jenkins持续集成-Unity3D命令行

        本文链接:https://www.haomeiwen.com/subject/ecsxtqtx.html