Write the Code. Change the World.

5月 08

https://docs.unity3d.com/cn/2021.3/Manual/webgl-interactingwithbrowserscripting.html

unity 调用 js

请使用 .jslib 扩展名将包含 JavaScript 代码的文件放置在 Assets 文件夹中的“Plugins”子文件夹下。格式如下。

mergeInto(LibraryManager.library, {

  Hello: function () {
    window.alert("Hello, world!");
  },

  HelloString: function (str) {
    window.alert(UTF8ToString(str));
  }
});

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注