-
Notifications
You must be signed in to change notification settings - Fork 22
Major changes in v4
Mariner edited this page Dec 22, 2024
·
3 revisions
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:
- Removed the third parameter of the
UnityWebgl
constructor. - Added
addUnityListener
andremoveUnityListener
methods to register and remove listeners for Unity to call. - On the Unity side, JS functions are called using
window.dispatchUnityEvent
. - The
on
andoff
methods are only used to listen for events during the creation and destruction of a Unity instance.
由于 v4.x
版本进行了较大更新,API 结构更加清晰,因此不兼容 v3.x
及之前的版本。请在升级时仔细阅读相关文档。
重要变更如下:
- 移除了
UnityWebgl
构造函数的第三个参数。 - 新增了
addUnityListener
和removeUnityListener
方法,用于注册和移除供 Unity 调用的监听器。 - 在 Unity 端,使用
window.dispatchUnityEvent
方法调用 JS 函数。 -
on
和off
方法仅用于监听 Unity 实例 从创建到销毁 过程中的事件。