0

I would like to build an app that uses augmented reality. To be honest, i prefer Android Studio, but i realized, that Unity3D with Vuforia might be the best choice for me. Im intrested in the best solution, to build my app in Android Studio, but clicking on a button (this will be my main usecase), i open the augmented reality project, i built in Unity. What would be the best solution?

UPDATE

Here is what i found:

First way:

I make my project in Unity, and exporting the project (add the module name to dependencies:



    dependencies{
    compile project(':UnityClasses')
    }

Then importing it into Android Studio. Then i could talk between modules like this:
How-to-call-method-and-return-its-value-with-unityplayer-unitysendmessage

If im correct here, in this way i can send data to Unity module within Android Studio by the 3rd parameter of UnitySendMessageExtension, and i can send data back by the Callstatic method.

Second way:

Use Unity as a Subview

Third way

Integrating Unity into Android Studio
Can anyone help me, who tried these above, to tell me what the best way is?

8
  • 1
    Possible duplicate of What is Gradle in Android Studio? Commented Feb 10, 2018 at 11:47
  • If you use Android Studio, your app can only be published for Android devices. You will have to learn and re-write it in Objective-C or swift to get it work in iOS. If you use Unity, your app can be published for Android and iOS without any modification. The decision here is not hard to make. Finally, this question don't belong here but I just wanted help regardless. Commented Feb 10, 2018 at 11:56
  • No, sorry, my question is totally different. Commented Feb 10, 2018 at 11:57
  • Thanks programmer i understand this. But for augmented reality app (i plan to do) i need to use database (I am planning to use firebase) and a lot of other usecases, that i dont really think, could be done in Unity. Commented Feb 10, 2018 at 11:59
  • What? You can't use firebase in Unity? If that's true then you can't ride a bicycle with a helmet. Please do a simple Google search before making more comments. Nothing you can do in Android Studio you can't do in Unity.... Commented Feb 10, 2018 at 12:03

1 Answer 1

0

Unity is a full development solution, so you really do not need to mix up with android studio.

And additionally, Unity is fully compatible with whatever you need because it is C# based so in addition to Unity specific support, anything that works for C# will work for Unity as well.

and here is a link to the Unity firebase SDK:

https://firebase.google.com/docs/unity/setup?gclid=EAIaIQobChMI56nk0-Cb2QIVAilpCh2GOw6zEAAYASAAEgIPZfD_BwE

The only real difference is if you don't like to program 50% visually 50% C# in Unity VS programming in javandroid (that's what I call whatever is going on in android studio ^-^').

Plus Unity exports to everything while android studio is exclusive to android devices, so developing for Unity has greater benefit.

EDIT:

You can call Android OS features written in java or c++, from C# by using the Native Plugins functionality:

https://docs.unity3d.com/Manual/AndroidJARPlugins.html https://docs.unity3d.com/Manual/NativePlugins.html

as well as extending the main activity with your own activities https://docs.unity3d.com/Manual/AndroidUnityPlayerActivity.html

All these features are there for when you want to do more than just games, like architectural visualization or whatever other app that requires 3D manipulations like AR.

Sign up to request clarification or add additional context in comments.

5 Comments

your answer is not fully right. Adding Android Studio or other Android IDE has a reason to be, there are things you can't do in Unity, particularly if you need some native code access. Just like you also need xcode for iOS and Visual Studio for UWP. You can do most of it in Unity but there will be moment when you need to code native.
That is my problem also. I would like to do material design, planning acitvities nicely. I dont know whether it can be done in unity or not. Also i would like to use the gps of the device. Is there a way, to use Android Studio for my project, but when i click on a button, the completed Unity modul starts running.
Whenever i check a Unity Android tutorial, I only see, that they are putting objects, and layers on each other, and it works. But i have never seen a tutorial when someone uses activities in Unity. But please fix me, i would be the happiest.
Edited to better suit the mentioned points. I don't think there is a way to run an app within an app the way you intend in android, what you would have to do is create the Unity project and then decompile the APK to move the code by hand into your desired button in your "main" app, however, as previously mentioned, in Unity you can do everything at once, its just a little bit of hoop jumping. I'm more of an Unreal and CryEngine guy but for the sheer versatility that Unity provides, its a very complete solution with some of the widest platform support available on the market.
I updated the question, according to any other answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.