Unity和onGameReady未定义

时间:2015-09-30 20:13:01

标签: airconsole

这是基于github的Air Console演示。

我编译了web的“基本”示例(没有改动),并在本地设置它,并使用来自网站的Simlulator语法运行。

控制器正确加载,但屏幕没有。

运行时有几个错误:

(program):1 Uncaught SecurityError: Blocked a frame with origin "http://MACHINENAME" from accessing a frame with origin "http://www.airconsole.com". Protocols, domains, and ports must match.

还有:

exception thrown: ReferenceError: onGameReady is not defined,ReferenceError: onGameReady is not defined
    at eval (eval at _JS_Eval_EvalJS (http://MACHINENAME/unity/Release/build-webgl.js:1:156420), <anonymous>:1:1)
    at eval (native)
    at _JS_Eval_EvalJS (http://MACHINENAME/unity/Release/build-webgl.js:1:156420)
    at Array.WRb (http://MACHINENAME/unity/Release/build-webgl.js:16:784695)
    at YKk (http://MACHINENAME/unity/Release/build-webgl.js:7:594173)
    at WKk (http://MACHINENAME/unity/Release/build-webgl.js:7:593680)
    at Array.Rpf (http://MACHINENAME/unity/Release/build-webgl.js:9:667389)
    at Array.Lwm (http://MACHINENAME/unity/Release/build-webgl.js:8:87554)
    at Object.zIn [as dynCall_iiii] (http://MACHINENAME/unity/Release/build-webgl.js:29:39143)
    at invoke_iiii (http://MACHINENAME/unity/Release/build-webgl.js:1:356104)Module.printErr @ screen.html:34
UnityConfig.js:76 Invoking error handler due to
Uncaught ReferenceError: onGameReady is not defined

1 个答案:

答案 0 :(得分:1)

OnGameReady方法在Unity插件中包含的WebGL Templates文件夹中定义。 确保导入并保留项目中的整个WebGL Templates文件夹。