Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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'.