Reputation: 11509
This is my first time using Unity, and I want to integrate it into an already existing Android app.
From what I've read, you need to package your Android project into a jar file. Since you can't include the resource folder in the jar, how do I handle all of the resources for my app? The app also uses the ActionBarSherlock and ViewPagerIndicator libraries which have resources of their own as well.
I basically just need a way to click a button on Android and pop up an Activity containing the Unity stuff. I want the rest of the app to be native Android code. Thanks for the help!
Upvotes: 9
Views: 10313
Reputation: 289
In some scenario developers using native platform technologies (like Android/Java & iOS/Objective C) want to include in their apps/games features powered by Unity (usually for 3D/2D Real Time Rendering), like AR experience, interaction with 3D models, 2D mini games.
You can now insert features powered by Unity (Starting with Unity 2019.3.a2) directly into your native mobile applications. These features include, but aren’t limited to, 3D or 2D real-time rendering functions such as augmented reality, 2D mini-games or 3D models.
You can integrate the Unity runtime components and your content in a native platform project. The Unity Runtime Library exposes controls to manage when and how to load/activate/unload within the native application.
Pre Requirements:
Limitations
While we tested many scenarios for Unity as a library hosted by a native app, Unity does not control anymore the lifecycle of the runtime, so we cannot guarantee it'll work in all possible use cases.
For example:
How it works
The build process overall is still the same, Unity creates the iOS Xcode and Android Gradle projects, but to enable this feature we changed the generated iOS Xcode and Android Gradle projects, they now have the following structure:
Integration Unity as a library in native Android app Step by step explanations on how to include the Android library part into your native application when needed.
Example: Integration Unity as a library in native Android app
Integration Unity as a library in native iOS app Step by step explanations on how to include the iOS library part into your native application when needed.
Example: Integration Unity as a library in native iOS app
Upvotes: 0
Reputation: 136
Hi Below are the steps to follow
Create a unity project using android pro.
import com.unity3d.player.UnityPlayerActivity;
public class MainActivity extends UnityPlayerActivity
Upvotes: 3
Reputation: 11509
I figured it out. I was following these directions but kept getting various error messages including ClassNotFound exceptions.
It turns out the way that ADT 17 handles .jar files broke this method of integrating Unity into Eclipse. After hours of searching, here's the fix I came up with:
Instead of adding classes.jar to your build path, you should just copy the classes.jar file into the /lib
directory of your project, and everything should work properly.
Upvotes: 6