I’m using Unity 4, and I’m trying to create a simple Google Native Client game. I need to call some javascript code from the NaCl module. According to http://docs.unity3d.com/Documentation/Manual/nacl-gettingstarted.html :
“To call browser JavaScript code from NaCl, you can call Application.ExternalCall or Application.ExternalEval. However, Google has removed support for Eval functionality for Chrome Apps, so this will not work when publishing to the Chrome Web Store. To work around this, you can either use Application.ExternalEval to send a string, which you then intercept in your moduleMessage method in unity_nacl.js, or…”
I’m trying to send a string with Application.ExternalEval and decode it in moduleMessage(), but moduleMessage is never receiving the string. I’ve tried:
Application.ExternalEval("MyFunc();");
Application.ExternalEval("window.postMessage(\"MyFunc();\", \"*\");");
But moduleMessage() never receives any new messages. Has anyone gotten this working?
Thanks