unity3d android互调

unityPlayer = new AndroidJavaClass("com.xxx.xxx.MainActivity");

            curActivity = unityPlayer.GetStatic<AndroidJavaObject>("m_PayProxy");// MainActivity 类的字段

            curActivity.Call("setGameObject", gameObject.name);
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = jc.GetStatic<AndroidJavaObject>("currentActivity"); // MainActivty
activity.Call("func")
AndroidJavaClass ssdk = new AndroidJavaClass("cn.sharesdk.unity3d.ShareSDKUtils");// Java Class
ssdk.CallStatic("setGameObject", gameObject); // 静态函数 ssdk.CallStatic<bool>("isValid", platform); // 有返回值的函数
// 1.Unity3d GameObject  2.GameObject 绑定的脚本函数 3.参数
UnityPlayer.UnitySendMessage(m_GameObject,"Message","onBuyProp.....");
上一篇:关于在for循环中绑定事件打印变量i是最后一次。


下一篇:Python去除文件中的空格、Tab键和回车