Integrate Unity screens with activities in Java

0

I need to join certain parts of a game made in Unity with an android app, is it possible? That is, put a game type introduction with unity and then use Android's own activities.

Something similar to joining java with native react.

Greetings

    
asked by Pablo Cegarra 26.11.2016 в 14:19
source

1 answer

1

Yes you can, at least in unity 5.3 and up you can export your unity project to Android Studio. Depending on what is your main activity you may be interested in starting in the unity and show your android activities above, or the reverse, start in the Android and then show the unity.

If you have knowledge of Android it is as easy as changing the intent-filter in the manifest.

To call native code from Unity and change Activity, the easiest thing in this case is to add a static function to the UnityPlayerActivity class to show the other activity, for example:

 AndroidJavaClass jc = new AndroidJavaClass("com.myorganizacion.mypaquete.UnityPlayerActivity");
 jc.CallStatic("mostrarActividadNativa");

showNativeActivity would be your static function that makes a startActivity of your native activity on Android.

    
answered by 04.02.2017 / 22:27
source