Skip to content

Major changes in v4

Mariner edited this page Dec 22, 2024 · 3 revisions

📚 Documents

v3.x Documents
v2.x Documents


As v4.x version has been significantly updated and the API structure is clearer, it is not compatible with v3.x and earlier versions. Please read the documentation carefully when upgrading.

Major changes:

  1. Removed the third parameter of the UnityWebgl constructor.
  2. Added addUnityListener and removeUnityListener methods to register and remove listeners for Unity to call.
  3. On the Unity side, JS functions are called using window.dispatchUnityEvent.
  4. The on and off methods are only used to listen for events during the creation and destruction of a Unity instance.

由于 v4.x 版本进行了较大更新,API 结构更加清晰,因此不兼容 v3.x 及之前的版本。请在升级时仔细阅读相关文档。

重要变更如下:

  1. 移除了 UnityWebgl 构造函数的第三个参数。
  2. 新增了 addUnityListenerremoveUnityListener 方法,用于注册和移除供 Unity 调用的监听器。
  3. 在 Unity 端,使用 window.dispatchUnityEvent 方法调用 JS 函数。
  4. onoff 方法仅用于监听 Unity 实例 从创建到销毁 过程中的事件。

Clone this wiki locally