unity不能直接调用html的方法,要通过jslib文件调用
步骤:
1)在assets文件夹下新建Plugins文件夹
2)在Plugins文件夹下新建一个txt,改成“自己想要的名字.jslib”
3)在jslib文件中写入想要的方法
mergeInto(LibraryManager.library, {undefined
Unity_WebGL:function(){undefined
PassInformation();
},
});
含义:html中的方法是PassInformation,unity中调用的方法是Unity_WebGL,
这个Unity_WebGL就像一个中介一样。第一行这个一定要有,实际
是mergeInto(LibraryManager.library,obj),这个obj也可以在外边写
unity调用web
原文链接:https://blog.csdn.net/jiamian123456/article/details/122129470



