替换已弃用的浏览器交互代码
Replace any deprecated code with the updated code.
阅读时间2 分钟最后更新于 1 个月前
Web 浏览器脚本交互涉及的某些代码已弃用,并已替换为替代代码。
如果您的代码包含任何已弃用的代码,则需要使用替换代码来更新代码,以防出现意外行为或代码损坏。
已弃用代码快速参考
以下代码已弃用,需要将其替换为替换代码。
已弃用代码 | 替换代码 |
|---|---|
| dynCall() | |
| Pointer_stringify() | |
| unity.Instance() | |
| gameInstance | |
将 dynCall 更改为 makeDynCall
dynCalldynCallmakeDynCallWebAssembly.Table例如,将:
dynCall('vii', callback, [1, 2])
更改为:
{{{ makeDynCall('vii', 'callback') }}}(1, 2)
将 Pointer_stringify() 更改为 UTF8ToString
Pointer_stringify()Pointer_stringify()UTF8ToString()例如,将:
var stringMessage = Pointer_stringify(message);
更改为:
var stringMessage = UTF8ToString(message);
将 unity.Instance 更改为 CreateUnityInstance
unity.Instanceunity.InstanceCreateUnityInstance例如,将:
var MyGameInstance = null; script.onload = () => { unity.Instance(canvas, config, (progress) => { /*...*/ }).then((unityInstance) => {
更改为:
var MyGameInstance = null; script.onload = () => { createUnityInstance(canvas, config, (progress) => { /*...*/ }).then((unityInstance) => {
将 gameInstance 更改为 unityInstance
gameInstancegameInstanceunityInstance例如,将:
MyGameInstance = gameInstance;
更改为:
MyGameInstance = unityInstance;