unity内置网页的一些插件
插件
uniwebview
支持IOS、Android,支持MacOS下Editor调试,但不支持PC以及Windows下Editor调试。
Embedded Browser
支持PC、MacOS,不支持Android和IOS。
3dwebview
PC、MacOS、IOS和Android都支持,但似乎用的人比较少,不知道有没有什么问题,且价格比较高,将近500美金。
SimpleWebView
PC客户端内嵌网页
PC平台内置网页使用
Embedded Browser插件
限制
视频播放:
This Asset does not include licenses for proprietary or patent-encumbered codecs such as h.264. (Most streaming sites use patent-encumbered codecs and will not work. YouTube videos generally work, unless they are live.) Consider re-encoding your content with an open codec supported by stock Chromium such as WebM or Ogg Vorbis.
最好用WebM或者Ogg视频格式
All activity (mouse clicks, JS calls, input) is sent asynchronously to a separate renderer process and the results are asynchronously reported back. As such, there is a short delay between when a command is issued and when the results are visible. The delay should be quite reasonable in most cases, but don’t expect results the same frame you issue a command.
输入,调用方法等指令的接收和返回信息都是异步的,会有延迟
使用
内嵌资源:要在Assets同级文件夹下建一个名为BrowserAssets的文件夹
localGame://
去访问该文件夹下对应资源
几种通讯形式
unity发布成WebGL的项目和网页的通讯
官方文档有
unity项目和项目内置网页的通讯
插件自带的话可以用插件提供的方法
unity项目和网页的通讯(两者独立)
此方法是项目去连接web服务器,达到和网页端的通讯
项目使用websocket和web服务器连接,web服务器转发给网页
socketio 两端都有插件