GithubHelp home page GithubHelp logo

acmhacker / xunitydeploy Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 4.0 16.09 MB

Compile Unity to iOS[Android] client

C# 69.99% Ruby 20.20% Objective-C 1.60% Objective-C++ 5.67% Shell 1.48% Batchfile 1.06%
unity3d deploy compile ios android auto react jekyll

xunitydeploy's Introduction

XUnityDeploy是针对Unity自动化编译Android/IOS的脚本。

环境

  • Xcode Version > 7.0

  • Ruby Version > 2.0

  • Unity Version > 5.0, 其中需要配置Android SDK,JDK, NDK等

  • Git or Svn

  • ios-deploy

步骤

  • XUnityDeploy放在Assets的同级目录

  • 拷贝plugins/EditorAssets/Editor

  • 配置参数XUnityDeploy_configs下的main.info.json, main.projmods.json, export.plist, unity_deploy.plist

  • ruby scripts/run_unity.rb -p ios[android]

XUnityDeploy的流程图

  1. run_unity启动脚本

  2. Ruby脚本生成Unity需要的配置unity_deploy

  3. XUnityDeploy读取unity_deploy配置,配置Unity项目,最后编译项目

  4. UnityDeployPostprocess在编译Unity之后需要配置Xcode项目(IOS)

    • 读取main.build,获取info
    • 获取projmods,配置Xcode项目
    • 获取info, 配置XcodeInfo.plist
  5. 对生成包进行重命名,并提交到down serve上

Rake使用

  • rake update 更新项目
  • rake compile:ios 编译ios项目
  • rake compile:android 编译android项目
  • rake install:ios 安装ios包
  • rake install:android 安装android包

目录结构说明

  • builds 最终生成包的目录(apk, xcode project, ipa)

  • ../XUnityDeploy_configs 配置文件目录

    • android.keystoreAndroid的签名文件,需要自己替换,并在unity_deploy中配置keystore
    • export.plist 是导出ipaxcode需要的配置文件。其中methodapp-store,enterprise, ad-hoc,development。参考export.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>compileBitcode</key>
	<false/>
        <key>method</key>
        <string>development</string>
        <key>teamID</key>
        <string>your team id</string>
        <key>provisioningProfiles</key>
        <dict>
            <key>your bundle id</key>
            <string>your provision name</string>
        </dict>
        <key>signingCertificate</key>
        <string>iPhone Developer</string>
        <key>signingStyle</key>
        <string>manual</string>
</dict>
</plist>
  • unity_deploy.jsonUnityXUnityDeploy中读取的配置,用于配置Unity的项目
{
    "ios" :
    {
        "Version" : "1.0",
        "BundleVersionCode": 1,
        "BundleIdentifier" : "com.501joy.over14",
        "ProductName" : "XUnityDeploy",
        "IsDevelopment" : false,
        "DefineSymbols" : "EXAMPLE",
        "StrippingLevel" : "UseMicroMSCorlib",
        "ScriptCallOptimizationLevel" : "FastButNoExceptions",
        "IOSTargetOSVersion" : "7.0",
        "AotOptions" : "nimt-trampolines=256",
        "ScriptBackent" : "IL2CPP",
        "Channel" : "500026"
    },
    "android" :
    {
        "Version" : "1.0",
        "BundleVersionCode" : 1,
        "BundleIdentifier" : "com.501joy.over14",
        "ProductName" : "XUnityDeploy",
        "IsDevelopment" : false,
        "DefineSymbols" : "EXAMPLE",
        "StrippingLevel" : "UseMicroMSCorlib",
        "OBB" : false,
        "ScriptBackent" : "IL2CPP",
        "KeystoreName" : "android.keystore",
        "KeystorePass" : "example",
        "KeyaliasName" : "example",
        "KeyaliasPass" : "example",        
        "Channel" : "600001"
    }
}
  • jenkins jenkins目录

  • logs 编译日志目录

  • scripts 运行脚本命令目录

  • tools 工具目录

  • unitys 编译脚本目录

  • utils 帮助脚本目录

说明

  • executeMethod class 'XUnityDeploy' could not be found 需要把plugins/Editor拷贝到Assets/Editor

  • 这里关于xcode项目的配置在UnityXUnityDeploy处理了,也就是配置main.projmods.json中的build_settings。这里还有一种方法在编译Unity之后,通过Xcodeproj配置xcode

  • Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn’t be completed 修改export.plist。还碰到过WWDR certificate expired, 需要重新更新一下,参考

  • 因为Unity切换平台(ios/android)比较慢,所以这里建议针对ios/android单独checkout一个目录

  • Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found."。这里需要把Ruby版本设置为system,即使用rvm use system 参考


关于对i18n支持

在项目中,需要支持游戏APP应用名称多国化,只需要配置一个i18n.projmods.json即可,在i18n.projmods.json中,指定对于的InfoPlist.strings, 比如

    "files": 
    [
        "i18n/en.lproj/InfoPlist.strings",
        "i18n/zh-Hans.lproj/InfoPlist.strings",
        "i18n/zh-Hant.lproj/InfoPlist.strings"
    ],

需要注意的是,在XCProject.cs中,需要ignore重复存在的情况

TODO

  • 检查编译环境的脚本

  • 自动提交客户端的脚本

  • Xcodeproj替代Editor/XCodeEditor

xunitydeploy's People

Contributors

acmhacker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.