Unity WebGL Player | xxx
WebGL builds are not supported on mobile devices.
SgUCore
这是unity打包webgl的修改版index.html
添加内容如下
jslib文件
mergeInto(LibraryManager.library, {
webMessage: function (eventName, arr){
window.ReportReady(Pointer_stringify(eventName), Pointer_stringify(arr))
}
});
html5调用untiywebgl,插入如下语句
//调用函数发消息给unity
var iframe = document.getElementById("iframe")
iframe.contentWindow.message('Cube', 'GetBase64', base64Str)
//监听unity发来的消息 (unityEvent 由unity发送函数定义)
window.addEventListener('unityEvent', this.uinityEvent, false)
如果vue想使用unitywebgl,插入如下语句
--src可以填相对路径也可使完整url链接
--调用发消息函数向unity发消息
this.$refs.iframe.contentWindow.message('Canvas', 'ShowFloor', 2)
--监听unity发出的由window.ReportReady广播的事件,(unityEvent 由unity发送函数定义)
mounted () {
window.addEventListener('unityEvent', this.uinityEvent, false)
}



