Version: 2019.2
iOS 构建过程详解
自定义 iOS 启动画面

Unity XCode 项目的结构

为 iOS 平台构建项目时,Unity 将创建一个包含 XCode 项目的文件夹。在将您的应用程序部署到设备之前,需要使用此项目来编译和签署应用程序;此项目还用于准备和捆绑您的游戏以便在 App Store 上分发。

Before building the iOS project make sure that you set the Bundle Identifier in Player settings. You may also choose the SDK version to run the game on the device or simulator.

Classes 文件夹

此文件夹包含用于集成 Unity Runtime 和 Objective-C 的代码。包含的文件 main.mmUnityAppController.mm/h 是应用程序的入口点,并且您可以创建自己的 AppDelegate(派生自 UnityAppController)。如果您有包含 AppController.h 的插件,则可以直接包含 UnityAppController.h 即可。如果在 Plugins/iOS 文件夹中有 AppController.mm/h,可以合并并重命名它们。

此外,InternalProfiler.h 文件定义了一个条件编译器来启用内部性能分析器。这是一个不经常更改的代码文件夹,您可以在此处放置自定义类。选择附加模式时,在构建之间会保留对此文件夹的更改,但此功能不支持多个构建目标,并要求 Libraries 文件夹的结构固定。

内部性能分析器具有快速且不易察觉的特点,可以提供以下基本信息:

  • 哪个子系统占用了最多帧时间,
  • .NET 堆大小,
  • GC 事件计数/持续时间。 请参阅内置性能分析器以了解更多信息。

Data 文件夹

此文件夹包含序列化的游戏资源以及 .NET 程序集(dlldat 文件)作为完整代码(如果启用剥离,则为元数据)。machine.config 文件包含各种 .NET 服务(例如安全性、WebRequest 等)的设置。每个构建都会刷新此文件夹的内容,不应人为进行修改。

Libraries 文件夹

如果项目是使用 IL2CPP 构建的,则此文件夹包含转换为 ARM 汇编程序(s 文件)或 libil2cpp.a 的 .NET 程序集。libiPhone-lib.a 文件是 Unity Runtime 静态库,RegisterMonoModules.cpp 将 Unity 本机代码与 .NET 绑定。每个构建都会刷新此文件夹的内容,不应人为进行修改。

其他新创建的自定义文件夹

您的自定义文件可以放在此处。

图形文件

Icons and splash screens (png files) are kept in asset catalogs found in the Unity-iPhone folder. These files are automatically managed by Unity. Launch Screens, their XML Interface Builders (xib files) and Storyboard files are stored in the project’s root folder. You can set them up in Player settings. When creating custom launch images, make sure you adhere to Apple’s Human Interface Guidelines.

属性列表文件

The Info.plist is managed via Player settings in Unity. This file is updated when building the player, instead of being replaced. You should not modify it unless it is really needed.

其他文件

这些文件包括 XCode 项目文件(xcodeproj 文件)以及仅在 Project Navigator 中显示的框架链接。


  • 2018–06–14 页面已修订
iOS 构建过程详解
自定义 iOS 启动画面