Search Unity

Cordova and Unity hybrid

Discussion in 'Android' started by Democre, Apr 8, 2013.

  1. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    Hello all, I am hoping someone can help me. I have just started to port an iOS app over to Android. In our iOS app, we have modified the applicable bit in the Unity generated XCode project to add a Cordova view to Unity's view as a subview.

    How would I do the same thing in Android? Has anyone done a Unity/Cordova hybrid?
     
  2. katoun

    katoun

    Joined:
    Dec 26, 2012
    Posts:
    91
    Hello,
    Why would you do that?
    Unity3d exports that XCode project for iOS build of Apple legal limitations. If not for those legal issues you would get an .ipa file as you get an .apk for Android builds (or the executables for Windows, Mac or Linux builds).
    That XCode project is the Unity3D player for your game for iOS, which is not intended to interfere with because then your project is not platform independent anymore, "going against" Unity3D's principles.
    I think it's not a forbidden thing but you will not be able to port your project to any platform with Unity3D, you would have to start from scratch making everything inside Unity3D (using web-sockets and other needed plugins, you can find a lot on the Asset Store) .
    If it runs inside Unity3D's editor it mostly will run on any supported platform with very little adjustments.

    Regards.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's not true...you can legally output .ipa files, as some other engines do (e.g. Flash Builder). It's perfectly fine to "interfere" with the XCode project, and in fact that's the advantage of having it, so you have more control over what sort of things you can do with the app. It's true that you wouldn't have easy one-click publishing to other platforms if you do that, but that's already the case with things like native code plugins on desktop platforms.

    --Eric
     
  4. katoun

    katoun

    Joined:
    Dec 26, 2012
    Posts:
    91
    You have native plugins for iOS and Android too, so no need to alter the XCode.
    Can you tell me please how are you going to profile your application inside Unity in this case, or port your XCode modifications to the desktop builds?
    If you have the possibility to make your project entirely inside Unity and "one click" build for iOS, Android, Web build, Mac, Windows, Linux why not do it from start?

    Regards.
    Catalin
     
  5. Democre

    Democre

    Joined:
    Mar 31, 2010
    Posts:
    345
    Wow this is a question from last April. The question was kind of how to make a subview (or its analogue) to Unity in Android, because I had done it in iOS.

    In my case, the reasons to do this were so that the company did not have to redo all of their native UI inside Unity. They were a primarily web dev shop and found Cordova to allow them to make a native UI app using their existing skill set.

    I would have preferred direct experience in mixing the 2 products, but any general experience in adding views in Android would have probably gotten me there.

    I don't need the answer anymore, but someone somewhere may.

    It is a bit presumptuous to try to fix someone's workflow. Believe me I know that it would be ideal to do everything inside of one tool. Sometimes you do not have the possibility of starting over. Sometimes you must work with what you've got. They had years of web app code, that simply needed some 3D capability thrown in there.
     
  6. katoun

    katoun

    Joined:
    Dec 26, 2012
    Posts:
    91
    @Democre: Have you done it for Android? Dose it work?

    Regards.