Creating a Simple Unity plugin to Android

The Lazy Coder · 42K views · 2013 · 4:08

Open on YouTube

Game programming & enginesSoftware (other)tutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering how to reach native Android features from Unity, since it shows a working Java plugin build from start to finish.

Recommended by 2 people across 2 different months, 2013 to 2014.

What it is

A short 2013 screencast in which The Lazy Coder builds a minimal Unity3D plugin for Android that calls native Java code. It does not touch any UI components and serves as a base example, with code uploaded to GitHub.

What people said

Strong rec The Lazy Coder · 2013-09 · Stack Overflow · on “Simple Alert in Android for Unity Plugin”

First, anything you do that will modify the User Interface, such as Messages, Dialogs, Labels ... etc. should only be done from the main thread. I dont know where the call your making is coming from, but if its not the main thread you may run into issues like this. This video set helped me to build my android plugins. Here is the playlist, he goes through the whole gambit. Ill start you off on the first android video. [this video] There are 3 android videos and all the examples work, just watch them in high definition so you can read the code being typed.

Recommends NoGall · 2013-11 · Stack Overflow · on “Unity3D Quit Android Game with user prompt”

As far as I'm aware, you'll have to write some kind of plugin to access native Android OS features. There are a few helpful videos on Youtube, on how to build plugins. I'd start here: [this video] Cheers.

Cites N0xus · 2013-12 · Stack Overflow · on “Eclipse set up issues”

I've just downloaded the current Android ADT from the Android website. When I go into the eclipse folder and start a new Android application, my project always has two errors complaining that android.R has not been imported. When I import android.r I still get two errors that complain about the follow lines of code (again, these are pre-written when I start the project): setContentView(R.layout.activity_main); getMenuInflater().inflate(R.menu.main, menu); The errors I get are as follows: activity_main cannot be resolved or is not a field main cannot be resolved or is not a field When I fix the first line I it suggests that I change it to the following: setContentView(R.layout.activity_list_i

Cites GrandOpener · 2014-05 · Stack Overflow · on “Can Android Studio be used to create Unity-plugin compatible JARs out of Library projects?”

When using Unity3d, "native" (pure-java) Android functionality can be accessed via Plugin. As described in the documentation [LINK] , There are several ways to create a Java plugin but the result in each case is that you end up with a .jar file containing the .class files for your plugin When I create an Android Application Project in eclipse, and set it is a library, it automatically generates a .jar file in the bin folder. I understand that this is a temporary file in the context of the Android toolchain, but this is the file that Unity needs in order to see the classes and build up it's own internal JNI magic. (The entire process is outlined very well here [this video] in case more clarity is