我应该为 iOS(Game Center) 和 Android(Google Play Games) 创建不同的项目吗?

Should I create different projects for iOS(Game Center) and Android(Google Play Games)?

我有一款使用 Unity 制作的 Android 游戏很成功,现在我想在 iOS 上发布它。

我应该有两个 Unity 项目,一个用于 Android,另一个用于 iOS,还是我可以只使用一个项目?

我使用 Google Play Games,我想为 iOS 使用 Game Center,但我不知道这是否可以在一个项目中运行。

Should I have two Unity projects, one for Android and another for iOS, or can I do it with an only project?

。您只需要一个项目。多个项目将很难维护,这是不必要的。

使用 Unity 的指令,例如 UNITY_IOSUNITY_ANDROID 使 Unity 包含您的 iOS 的 Game Center 代码和 Google Android 的 Play 游戏代码在 编译期间。 有关其他指令,请参阅 Platform dependent compilation


您也可以在运行时通过检查 Application.platformRuntimePlatform.AndroidRuntimePlatform.IPhonePlayer 来执行此操作。