- Unity小游戏编译完无法上传预览 80082
隔了一个来月,开Unity,使用unity微信小游戏转换插件(202301051419) SDK功能选项: 使用微信音频API 调试编译选项:ClearStreamingAssets, WebGL2.0 官方功能仅接了广告。 编译时一切正常。到微信开发者工具中,点击预览,然后上传中则无法上传,报错如下: message:Error: 系统错误,错误码:80082,get plugin(id: wx7a727ff7d940bb3f, version: 0.0.14) failed, permission deny [20230116 10:31:44][wxd79d4334010da404] appid: 000000000000000000(人工马赛克) openid: o6zAJswVj3HJZCZTFi26Pm7XM4tM ideVersion: 1.06.2301040 osType: win32-x64 time: 2023-01-16 10:31:47 而同样的项目,mac编译和上传正常。而且一个月前同项目版本win编译上传是正常的。
2023-01-16 - 彻底解决canvasToTempFilePath 无法获取到图片(获取到空白图片、黑色图片、canvasid不存在)等等
canvasToTempFilePath 的坑太多了,不同环境有不同的坑,不同版本的canvas接口有不同的坑,为了彻底解决这些问题最好的方法就是不用它。 直接用toDataURL获取base64图像数据,然后再写入临时文件即可 [代码]// 获取base64图像 const b64Data = this.ctx.canvas.toDataURL() const time = new Date().getTime(); const filePath = `${uni.env.USER_DATA_PATH}/temp_image_${time}.png` // base64格式的图片要去除逗号前面的部分才能正确解码 const buffer = uni.base64ToArrayBuffer(b64Data.substring(b64Data.indexOf(',') + 1)) // 写入临时文件 uni.getFileSystemManager().writeFile({ filePath, data: buffer, encoding: 'utf8', success: res => { console.log('保存图片:', filePath) } }) [代码]
2022-05-24