Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Same project for iOS and Android

Discussion in 'General Discussion' started by Raial, Dec 9, 2017.

  1. Raial

    Raial

    Joined:
    May 2, 2017
    Posts:
    24
    Hi!

    I have an Android Game that is succeeding and now I want to launch it for iOS.

    Should I have two projects, one for Android and another for iOS, or can I do it with an only project?
    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.

    Thanks :)
     
  2. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    I don't know the specifics, but a lot of the whole point in using an engine like Unity is that the whole multi-platform thing is taken care of for you. There are functions available that will tell you what platform you are running on(at run-time) so whatever code you are using for platform specific ads(or anything really) can be put inside if statements that do different things depending on which platform you are on.

    So yeah, I highly recommend you use a single project. This way, when you update, you only update once.
     
  3. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,003
    Yea, you only need a single project.
     
    angrypenguin likes this.
  4. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    The play games, and game center plugins can be made to build for only certain platforms, and you can use the some compiler directives to control what platform code is compiling for.

    https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

    the majority of your code will be the same for both platforms, so this should only be a issue where you need to swap calls to play games for calls to game center.
     
  5. Raial

    Raial

    Joined:
    May 2, 2017
    Posts:
    24
    Thanks for all the replies :)

    I'll do it in a single project trying to use compiler directives.
     
  6. AxPetre

    AxPetre

    Joined:
    Jun 1, 2013
    Posts:
    96
    Keep in mind that if your Android version uses a lot of textures with ETC and ETC2 formats set to high quality, then switching from one platform to another and back will cause those textures to be re-imported, which is a painfully slow process, and you can end up losing many hours just waiting for those damn things to be re-imported.
     
  7. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,454
    Cache Server can significantly reduce this time. Newer Unity versions feature a "Local Cache Server" as well.
    https://docs.unity3d.com/Manual/CacheServer.html
     
  8. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,003
    This. Always this. If you are on a team a dedicated remote cache server is a huge benefit as well.
     
    Peter77 likes this.
  9. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,796
    Yep, this is the way to go.
     
  10. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    The harder thing to do isn't iOS and Android in one project, that's nice and easy, it's multiple android stores in one project (amazon, google play etc). But still do it in one project. You'll have some pain occasionally but save a lot of time on updates later on... just remember you only notice the bad, so even when things feel like they'd be easier as two projects, it's probably not the case.
     
  11. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,796
    Why is that a problem? Unity IAP abstracts this all away from you. I also have a dropdown in my init scene where I select which store I'm currently in, then I inject any store logic into behaviours that need it.
     
  12. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Ah, right, that's true. I haven't released anything on multiple Androids with Unity IAP yet.