Replace deprecated browser interaction code
Replace any deprecated code with the updated code.
Read time 2 minutesLast updated 10 days ago
Some code involved with web browser script interactions is deprecated and has been replaced with alternative code.
If your code contains any of the deprecated code, you need to update the code with the replacement code to prevent unexpected behavior or broken code.
Deprecated code quick reference
The following code is deprecated and you need to replace it with the replacement code.
Deprecated code | Replacement code |
|---|---|
| dynCall() | |
| Pointer_stringify() | |
| unity.Instance() | |
| gameInstance | |
Change dynCall to makeDynCall
The function is deprecated. If you have any code that uses , replace it with . Make this change whether you have enabled or not.
dynCalldynCallmakeDynCallWebAssembly.TableFor example, change:
dynCall('vii', callback, [1, 2])
to:
{{{ makeDynCall('vii', 'callback') }}}(1, 2)
Calling a function with no arguments
When migrating a that has no arguments, you must add empty parentheses () after the template to invoke the function.
dynCallmakeDynCallFor example, change:`
dynCall('v', callback, []);
to:
{{{ makeDynCall('v', 'callback') }}}()
Change Pointer_stringify() to UTF8ToString
The function is deprecated. If your code contains calls to , replace the calls with .
Pointer_stringify()Pointer_stringify()UTF8ToString()For example, change:
var stringMessage = Pointer_stringify(message);
to:
var stringMessage = UTF8ToString(message);
Change unity.Instance to CreateUnityInstance
unity.Instanceunity.InstanceCreateUnityInstanceFor example, change:
var MyGameInstance = null; script.onload = () => { unity.Instance(canvas, config, (progress) => { /*...*/ }).then((unityInstance) => {
to:
var MyGameInstance = null; script.onload = () => { createUnityInstance(canvas, config, (progress) => { /*...*/ }).then((unityInstance) => {
Change gameInstance to unityInstance
The property is deprecated. If your code uses , use instead.
gameInstancegameInstanceunityInstanceFor example, change:
MyGameInstance = gameInstance;
to:
MyGameInstance = unityInstance;