/unity-android-back-button-plugin

Android plugin for Unity 3D to handle BACK button to display a dialog asking user if he wants to quit

Primary LanguageJava

This Unity 3D plugin sample shows how to handle BACK button on Android to
display a dialog asking user if he wants to quit.

1. Save this Eclipse project to Assets/Plugins/Android
directory of your Unity project.

Do not save as a subdirectory. AndroidManifest.xml should be right in
Assets/Plugins/Android

2. Copy classes.jar in Unity to libs directory.

On Mac OS X, typically it is at:
/Applications/Unity/Unity.app/Contents/PlaybackEngines/AndroidPlayer/bin/classes.jar

3. Use Eclipse to build JAR file:

Add classes.jar copied above to the project build path for Eclipse.

Right click project name -> Export... -> JAR file
Select everything if you are not sure.
Normally you only have to select .class files and resource files.

4. Use Ant to build JAR file:

If you want to use Ant instead of Eclipse:

$ android update project --path .
$ ant release

Files will be created in bin directory.

To sign or obfuscate the created JAR file, see ant.properties.