Skip to content

Commit a39d8e8

Browse files
committed
Made the plugin work when the "WebAssembly.Table" build option is enabled.
1 parent 8b93cf8 commit a39d8e8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Assets/WebGLCopyAndPaste/Plugins/WebGLCopyAndPaste.jslib

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,14 @@ var WebGLCopyAndPaste = {
6969
var bufferSize = lengthBytesUTF8(str) + 1;
7070
var buffer = _malloc(bufferSize);
7171
stringToUTF8(str, buffer, bufferSize);
72-
if (typeof Module !== undefined && Module.dynCall_vi) {
72+
if (typeof Module !== "undefined" && typeof Module.dynCall_vi !== "undefined") {
7373
Module.dynCall_vi(callback, buffer);
74-
} else {
74+
} else if (typeof Runtime !== "undefined" && typeof Runtime.dynCall !== "undefined") {
7575
Runtime.dynCall('vi', callback, [buffer]);
76+
} else if (typeof getWasmTableEntry !== "undefined") {
77+
getWasmTableEntry(callback)(buffer);
78+
} else {
79+
throw new Error("[WebGLCopyAndPaste]: Couldn't find 'Module.dynCall_vi', 'Runtime.dynCall' or 'getWasmTableEntry'");
7680
}
7781
}
7882

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ https://github.com/kou-yeung/WebGLInput
3030
The plugin has been tested an confirmed working on:
3131

3232
* Edge 120.0.2210.61 (Chromium) on Windows 10, Unity 2022.3.10, 2021.3.25 and 2020.3.18.
33-
* Firefox 120.0.1 on Windows 10, Unity 2022.3.10, 2021.3.25 and 2020.3.18.
33+
* Firefox 120.0.1 to 134.0.2 on Windows 10, Unity 6.0.34, 2022.3.22, 2022.3.10, 2021.3.25, 2020.3.18.
3434
* Safari 16.6 on macOS Ventura 13.6, Unity 2022.3.10.
3535
* Chrome 118.0.5993.70 on macOS Ventura 13.6, Unity 2022.3.10.
3636
* Firefox 120.0.1 on macOS Ventura 13.6, Unity 2022.3.10.
@@ -54,6 +54,10 @@ The plugin has been tested an confirmed working on:
5454

5555
## ChangeList
5656

57+
* 0.4.0
58+
59+
* Made the plugin work when the "WebAssembly.Table" build option is enabled
60+
5761
* 0.3.0
5862

5963
* Added `Preserve` attribute to `WebGLCopyAndPasteAPI` class, and `AlwaysLinkAssembly` to the assembly,

0 commit comments

Comments
 (0)