i have calling java function from my unity code.
I have both static & non-static type of functions in my java class
To access first static function, i used:
AndroidJavaClass plugin = new AndroidJavaClass("com.android.test.TestActivity");
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
plugin.CallStatic("InstantiateMe", qwe);
above code is running fine, but after this , when i m trying to execute my non static function, its not actually executing.. Not even giving any exception or error..
My code to call non-static function
AndroidJavaClass plugin = new AndroidJavaClass("com.android.test.TestActivity");
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
plugin.Call("Enable", qwe);
Help me guyz. i stucked here.
use your “activity” variable for non-static calls:
activity.Call("Enable", qwe);There is example of static and non-static functions calls:
Take a look on example of Android plugin for Unity3D for detailes.