UnityのC#でJavaScriptを呼び出して、JavaScriptからUnityのC#に値を持ってきたい。
解決したいこと
UnityのC#でJavaScriptを呼び出して、JavaScriptからUnityのC#に値を持ってきたい。
該当するソースコード
Atsumaru.gift.total(this.gameObject.name,((Action<string>) this.test).Method.Name);
と書き実行しました。
testメソッドは下のようにし、
public void test(string a){
Text testn = test.GetComponent<Text> ();
testn.text = a;
}
Atsumaruクラスは、
public static class Atsumaru
{
public static class gift
{
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
private static extern string AtsumaruGiftTotal(string objectName,string objectMethod);
#endif
public static void total(string objectName,string objectMethod)
{
#if UNITY_WEBGL && !UNITY_EDITOR
AtsumaruGiftTotal(objectName,objectMethod);
#endif
}
}
こう書きました。
jslibは、
AtsumaruGiftTotal:function(objectName,objectMethod){
window.RPGAtsumaru.gift.getTotalPoints().then(function(v) {unityInstance.SendMessage(objectName,objectMethod,v);});
}
としました。
しかし、なにも起こりませんでした。
どこが間違っているのかさっぱりです。
どなたかお助けください。
0 likes