There are a lot of questions about running native Android and iOS code in Unity. I am trying to run Unity inside of native Android and native iOS apps.

My problem is that I have two native apps, and I don't want to write code twice when I add a feature.

I currently have two native apps - one in Android and one in iOS. I am trying to write code once, and add it to both. Can I write a Unity program, and put that into my native apps?

I am thinking something along the lines of writing a Unity Android app, building it as an Activity instead of an APK, and launching that Activity from the native android app. Then also the equivalent in iOS, whatever that may be.

Does anyone know a solution to this problem?

  • 1
    \$\begingroup\$ I'm pretty sure you don't want to do what you are describing. \$\endgroup\$ – Almo Oct 23 '19 at 15:20
  • \$\begingroup\$ @Almo I most certainly do not. It sounds miserable. Do you have a better alternative? \$\endgroup\$ – Evorlor Oct 23 '19 at 15:21
  • 1
    \$\begingroup\$ Write one Unity application, deploy to many devices. Don't worry about "native". That's just my opinion; I'm all about pragmatic development. I wrote Cognizer with Unity, and it's deployed on Android, iOS, Windows, OSX, and Linux. Only platform-specific code is Android back button. \$\endgroup\$ – Almo Oct 23 '19 at 15:21
  • \$\begingroup\$ @Almo I would very much prefer that. But the native apps already exist, and cannot be rebuilt in Unity (for logistical reasons). \$\endgroup\$ – Evorlor Oct 23 '19 at 15:23
  • 2
    \$\begingroup\$ I believe this may help . I remember using unity in a native app several years ago and it just seemed easier to import the native stuff and use within unity but I have yet to see this new content Unity2019.3 \$\endgroup\$ – Justin Markwell Oct 23 '19 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.