Version: 2022.1
iOS requirements and compatibility
Structure of a Unity Xcode Project

Inside the iOS build process

Editor Based Building and Running

The iPhone/iPad application build process is a two step process:

  1. Xcode project is generated by Unity with all the required libraries, precompiled .NET code and serialized assets.
  2. Xcode project is built by Xcode and deployed and run on the actual device.

When “Build” is hit on “Build settings” dialog only the first step is accomplished. Hitting “Build and Run” performs both steps. If in the project save dialog the user selects an already existing folder an alert is displayed. Currently there are two Xcode project generation modes to select:

  • replace - all the files from target folder are removed and the new content is generated
  • append - the “Data”, “Libraries” and project root folder are cleaned and filled with newly generated content. The Xcode project file is updated according to the latest Unity project changes. Xcode project “Classes” subfolder could be considered as safe place to place custom native code, but making regular backups is recommended. Append mode is supported only for the existing Xcode projects generated with the same Unity iOS version.

If Cmd+B is hit then the automatic build and run process is invoked and the latest used folder is assumed as the build target. In this case append mode is assumed as default.

Note: Step one above can be performed on a PC or a Mac. Only a Mac can perform Step two. This means to get a Unity project running on an iDevice you will need to have a Mac.

Command Line Building

Once Unity has been used to build the Xcode project it is possible to perform the build and run from the command line. After the editor has built the Xcode project do the following from the terminal:

unity$ xcodebuild test -destination "platform=iOS,id=400d20d00baf8d4997b47be0416cf5c44dd2d3bc" -scheme Unity-iPhone

Note that 400d20d00baf8d4997b47be0416cf5c44dd2d3bc in the command line example above is the ID of the iDevice that will run the project. You will need to determine your device ID using the Window > Devices menu in Xcode.

Incremental build pipeline

Unity uses the incremental build pipeline when it builds the Player for iOS. This means that Unity incrementally builds/generates files such as Information Property List (plist) files and Entitlement files. If you implement callbacks that modify or move any iOS file or asset that the incremental build pipeline uses, see Creating non-incremental builds.

iOS requirements and compatibility
Structure of a Unity Xcode Project
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961