Skip to content Skip to sidebar Skip to footer

How To Import Unity Project Into Existing Android Studios Project?

I am having problems importing unity project into Android Studios. I already have a Android studio project (for menu and other things), and i want to add a scene from Unity 5 3D, a

Solution 1:

Had the same requirement and successfully imported the Unity project into an existing Android Studio project. As mentioned the first thing will be to export the Unity project. I used Unity version 2017.1. Rough steps below:

  1. Export Android project via Unity build settings

enter image description here

  1. You can simply select the folder where your existing project is located. Unity should add a sub folder with an Android Studio format project and all dependencies and everything it needs to run.

  2. Now we need to convert this "Application" project to a "Library" project. This is simply done by changing the build.gradle file. Replace apply plugin: 'com.android.application' with apply plugin: 'com.android.library'.

You also need to remove the applicationId and change the compile versions to match your project's versions.

  1. Also make sure to modify the Unity module AndroidManifest.xml file. You will need to remove the LAUNCHER intent-filter as the UnityPlayerActivity will not be the main activity anymore.

    android.intent.action.MAIN

    android.intent.category.LAUNCHER

Also need to remove the Application node attributes so it won't conflict with your project's manifest.

  1. Finally in your settings.gradle add the module and then add the Unity project dependency on your "app" module: compile project(':UnityFolder')

  2. Build and now you should be able to start the Unity Scene by calling:

    Intent intent = new Intent(this, UnityPlayerActivity.class);

    startActivity(intent);

Solution 2:

yes we can start another activity before unity Activity 1 step-create java class and add it in manifest and like in image

2nd step- create onClick in java class link to unity game class s you can see in amage see pic, you can choose button also

3rd step- in manifest replace Intent in own java class it will work [3]

Solution 3:

From this link: https://nevzatarman.com/2015/01/04/unity-android-tutorial-opening-unity-scene-from-an-activity/

Add android:process=":UnityKillsMe" to the unity activity GameActivity.

Post a Comment for "How To Import Unity Project Into Existing Android Studios Project?"