Unity 和 onGameReady 未定义

Unity and onGameReady not defined

这是基于 github 的 Air Console 演示。

我为 Web 编译了 "basic" 示例(没有改动),并在本地进行设置,并使用网站上的 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

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