为 iOS 平台构建项目时,Unity 将创建一个包含 XCode 项目的文件夹。在将您的应用程序部署到设备之前,需要使用此项目来编译和签署应用程序;此项目还用于准备和捆绑您的游戏以便在 App Store 上分发。
在构建 iOS 项目之前,请务必在 Player Settings 中设置 Bundle Identifier。还可以选择在设备或模拟器上运行游戏的 SDK version。
此文件夹包含用于集成 Unity Runtime 和 Objective-C 的代码。包含的文件 main.mm
和 UnityAppController.mm/h
是应用程序的入口点,并且您可以创建自己的 AppDelegate(派生自 UnityAppController)。如果您有包含 AppController.h
的插件,则可以直接包含 UnityAppController.h
即可。如果在 Plugins/iOS 文件夹中有 AppController.mm/h
,可以合并并重命名它们。
此外,InternalProfiler.h
文件定义了一个条件编译器来启用内部性能分析器。这是一个不经常更改的代码文件夹,您可以在此处放置自定义类。选择附加模式时,在构建之间会保留对此文件夹的更改,但此功能不支持多个构建目标,并要求 Libraries
文件夹的结构固定。
内部性能分析器具有快速且不易察觉的特点,可以提供以下基本信息:
此文件夹包含序列化的游戏资源以及 .NET 程序集(dll
或 dat
文件)作为完整代码(如果启用剥离,则为元数据)。machine.config
文件包含各种 .NET 服务(例如安全性、WebRequest 等)的设置。每个构建都会刷新此文件夹的内容,不应人为进行修改。
如果项目是使用 IL2CPP 构建的,则此文件夹包含转换为 ARM 汇编程序(s
文件)或 libil2cpp.a
的 .NET 程序集。libiPhone-lib.a
文件是 Unity Runtime 静态库,RegisterMonoModules.cpp
将 Unity 本机代码与 .NET 绑定。每个构建都会刷新此文件夹的内容,不应人为进行修改。
您的自定义文件可以放在此处。
图标和启动画面(png
文件)保存在 Unity-iPhone
文件夹中的资源目录中。这些文件由 Unity 自动管理。启动屏幕、它们的 XML 接口构建器(xib
文件)和 Storyboard 文件存储在项目的根文件夹中。可在 Player Settings 中对它们进行设置。创建自定义启动图像时,请确保遵守 Apple 的人机接口指南。
Info.plist
通过 Unity 中的 Player Settings 进行管理。构建播放器时,此文件被更新,而不是被替换。除非确实需要,否则不应对其进行修改。
这些文件包括 XCode 项目文件(xcodeproj
文件)以及仅在 Project Navigator 中显示的框架链接。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.