Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  5. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

Targeting IPhone and Android with C#

Discussion in 'Scripting' started by TerryMcP63, Jun 1, 2012.

  1. TerryMcP63

    TerryMcP63

    Joined:
    Jun 1, 2012
    Posts:
    1
    Hello everyone,

    I'm just getting started - thinking about developing a simple Avatar using C#. I'm wondering about the following and would appreciate pointers to existing material which may answer my questions. If anyone would care to offer direct feedback, I'd be grateful.

    When developing a C# code base for a simple Avatar project that targets both Android and iPhone, will I encounter the need to develop platform specific code?

    Let's assume that I won't go out of my way to target platform specific features and would endeavor to reduce any platform specific coding. Given these rather vague constraints, what percentage of platform specific code can I expect?

    Should I plan on targeting, say, Android now and "port" to iPhone later - or would it be significantly simpler to target both platforms up front?

    Many thanks in advance for any guidance that may be offered.

    Terry
     
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    The documentation is probably going to answer most of your questions. I think Android and IPhone share alot of the same features. Both have some specific but it's not that bad.

    some 99% of your code will not be platform specific, and you can add things in that will simple get the data you need from either and put it where you need it to be. I have done Android/pc games which are far different. But once you get the feel down, you are good.

    http://unity3d.com/support/documentation/ScriptReference/index.html
     
  3. _Petroz

    _Petroz

    Joined:
    May 13, 2010
    Posts:
    731
    Unity does cross platform development very well. I don't have any platform specific code differences between iOS and Android.

    That is what I did, mainly because I didn't own a mac when I started. Most of the effort of 'porting' was setting up the dev environment on my mac when I did get one. Once I had everything installed, I opened my project and Unity spent a while (maybe10 minutes) reimporting the assets and it worked right away.

    If you make a plugin which links to java/native code then that will require platform specific code. Other than that it all pretty much 'just works'.