java - Android Unity plugin -


i want use unity android plugin in ar application. app has ar camera, image target , 3d object.

on eclipse :

i create default android application on eclipse. click build automatically , check project name -> proeprties -> islibrary. create class named bridge on eclipse project.

bridge.java

package com.tutorial.pluginforunity; public class bridge {      public static int returnint() {         return 5;     } } 

on unity : create bridgeforunity.cs file. conent of :

using unityengine; using system.collections; using system; using system.runtime.interopservices;  public class bridgeforandroid : monobehaviour {      #if unity_android      //&& !unity_editor     public static int returnint () {         androidjavaclass ajc = new androidjavaclass("com.tutorial.pluginforunity.bridge");         return ajc.callstatic<int>("returnint") ;     }     #endif      void start () {      }      void update () {      } } 

i edit defaulttrackableeventhandler.cs attached image target.

private void update() {     #if unity_android      gui.label(new rect(10, 10, 100, 20), "return = " + bridgeforandroid.returnint());     #endif     if (input.getkeydown(keycode.escape)) { application.quit(); } } 

i copy jar file under bin folder in eclipse project. paste under assets/plugins/android.when run application, see black screen.

to see return value plugin, move code ongui update.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -