Hello,
I am quite new at Unity and I am trying to create a Unity plugin for an Android library and I ma facing the following issues:
- I can’t find a way to pass the back button event to Android library. What I have managed to do is to pass touch events to the activity on the Android side by setting the following line
at <activity android:name=“com.unity3d.player.UnityPlayerProxyActivity” … > in the AndroidManifest
However I cannot pass the back button event in a way that I do not have to change the code in the library
What I do for now in my script is
public void Update() {
if(Input.GetKeyDown(KeyCode.Escape))
Application.Quit();
}
However I need the option to pass that back event that I capture, to the library and not handle it at the Unity layer.
- I am trying to reference in my script an enum that I have in my Android library.
For example I have the following enum in a Place.java file
package com.myapp.constants;
public enum Place {
TOP, BOTTOM, RIGHT, LEFT
}
and I want to find a way to reference it from my script.
I tried something like that:
AndroidJavaClass topPlace = new AndroidJavaClass(“com.myapp.constants.TOP”);
but with no luck.
Can anyone help on those issues? Any help appreciated…