简体   繁体   English

我应该为iOS(游戏中心)和Android(Google Play游戏)创建不同的项目吗?

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

I have an Android Game made with Unity that is succeeding and now I want to launch it for iOS. 我有一个由Unity制作的Android游戏正在成功,现在我想为iOS启动它。

Should I have two Unity projects, one for Android and another for iOS, or can I do it with an only project? 我应该有两个Unity项目,一个用于Android,另一个用于iOS,还是可以只使用一个项目?

I use Google Play Games and I want to use Game Center for iOS, and I don't know if it all could work in a single project. 我使用Google Play游戏,也想使用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项目,一个用于Android,另一个用于iOS,还是可以只使用一个项目?

No . 不行 You only need one project. 您只需要一个项目。 Multiple projects will be very hard to maintain and that's unnecessary. 多个项目将很难维护,这是不必要的。

Use Unity's directives such as UNITY_IOS and UNITY_ANDROID to make Unity include your Game Center code for iOS and Google Play Games code for Android during compile-time. 使用Unity的指令(例如UNITY_IOSUNITY_ANDROID使Unity在编译时包含iOS的Game Center代码和Android的Google Play游戏代码 See Platform dependent compilation for other directives. 有关其他指令,请参见平台相关的编译


You can also do this during runtime by checking Application.platform with RuntimePlatform.Android and RuntimePlatform.IPhonePlayer . 您也可以在运行时通过使用RuntimePlatform.AndroidRuntimePlatform.IPhonePlayer检查Application.platform来执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM