- 审核版本的包能获取到游戏的版本号吗?
调用wx.getAccountInfoSync()后,开发版和体验版都无法获取到版本号(version),那提审版能获取到吗?? 并且wx.getAccountInfoSync()的 envVersion 只区分了 开发版、体验版、正式版。那提审的包获取 envVersion 是算哪个版本呢??
06-18 - 小游戏加载完成后,连带着微信直接闪退了
小游戏加载完成后,连带着微信直接闪退了。 用户反馈日志后,发现日志没有 error openID:o9yum7bL3xg2GukcS-qtGvyGHtpM 日志链接:https://mp.weixin.qq.com/wxopen/reportwxadevlog?action=download_log&record_id=2&lang=zh_CN&token=2034791557
05-14 - Unity 转微信小游戏后,微信小游戏开发平台怎么拿到屏幕上的 canvas?
我使用了 Unity 导出,有 weapp-adapter.js,我知道在这里面已经绘制过一次了,所以我自己绘制的全部是离屏画布,但是我应该怎么获取屏幕上的画布,将我的离屏画布绘制上去呢?? 使用 GameGlobal.canvas.getContext('2d') 打印出来为 null.......
05-11 - 如何拿到 屏幕上的 Canvas,将我创建的离屏画布绘制上去?
我使用了 Unity 导出,有 weapp-adapter.js,我知道在这里面已经绘制过一次了,所以我自己绘制的全部是离屏画布,但是我应该怎么获取屏幕上的画布,将我的离屏画布绘制上去呢?? 以下代码还需要添加什么?? var canvas = wx.createCanvas(); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#FF0000"; ctx.fillRect(200, 150, 400, 200); 使用 GameGlobal.canvas.getContext('2d') 打印出来为 null.......
05-10 - 在 Unity 中使用构建模板的钩子为什么不会被调用??
查看开发者文档,在对应的目录下创建好了文件并且使用了样例的代码,但是在构建的时候,并没有触发。 请问是为什么?难道是需要在某个地方调用 PluginDemo 这个函数吗??按道理来说,应该是自动触发的吧。。。 https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/BuildTemplate.html#%E6%9E%84%E5%BB%BA%E6%A8%A1%E6%9D%BF%E5%89%8D%E5%90%8E%E4%B8%8D%E5%90%8C%E6%97%B6%E6%9C%BA%E7%9A%84%E9%92%A9%E5%AD%90 // plugin.cs using System.IO; using UnityEngine; using WeChatWASM; /// <summary> /// 构建生命周期回调钩子 /// 注意事项: /// 请创建脚本在 Editor (子)目录下; /// 回调钩子请使用 public 声明成员函数 /// </summary> public class PluginDemo : LifeCycleBase { public override void afterCopyDefault() { // code... Debug.Log("afterCopyDefault"); } public override void beforeCopyDefault() { // 可使用 Exception 阻止继续构建导出 throw new System.Exception("Build Failed."); } public override void beforeCoverTemplate() { // 读取你的自定义模板目录并对其中的资源做动态修改 var tmp = BuildTemplateHelper.CustomTemplateDir; using ( FileStream file = new FileStream( Path.Combine(tmp, "newFile.js"), FileMode.Create, FileAccess.Write)) { using (StreamWriter writer = new StreamWriter(file)) { writer.WriteLineAsync("Your Code Content."); } } // 尽管你在导出期间动态的创建/修改了自定义模板中的资源 // 在导出结束后WXSDK会自动恢复你的修改 } }
04-17 - 微信小游戏无法使用 script.onload = function () {} 吗??????
Setup: function (strJsonDataPtr) { try { if (typeof UTF8ToString !== 'function') { throw new Error("UTF8ToString is not defined."); } const strJsonData = UTF8ToString(strJsonDataPtr); console.log("[WebGL] Setup data received from Unity:", strJsonData); const setupOptions = JSON.parse(strJsonData); // 动态加载 SDK var script = document.createElement('script'); script.src = 'Build/main.js'; // 修改为正确路径 script.type = 'text/javascript'; document.body.appendChild(script); console.log("[WebGL] Loading SDK script..."); script.onload = function () { console.log("11111111111111"); try { console.log("[WebGL] SDK script successfully loaded."); if (typeof SDK === 'undefined') { throw new Error("SDK is not loaded."); } if (typeof SDK .Manager !== 'function') { throw new Error("SDK .Manager is not defined or is not a function."); } const instance = new SDK .Manager(); console.log("[WebGL] Setup options:", setupOptions); // 调用 SDK 的 setup 方法,采用回调方式处理结果 instance.setup(setupOptions, function (result) { if (result.success) { console.log("[WebGL] Setup completed successfully:", result); const successMessage = JSON.stringify({ result: true }); SendMessage("WebGL", "_SetupSucceed", successMessage); } else { console.error("[WebGL] Setup failed:", result.error); const failureMessage = JSON.stringify({ result: false, error: result.error || "SDK initialization failed", }); SendMessage("WebGL", "_SetupFailed", failureMessage); } }); } catch (error) { console.error("[WebGL] Error during SDK Setup:", error); const errorMessage = JSON.stringify({ result: false, error: error.message, }); SendMessage("WebGL", "_SetupFailed", errorMessage); } }; console.log("2222222222222222"); script.onerror = function (errorEvent) { console.error("[WebGL] Failed to load SDK script:", errorEvent); const errorMessage = JSON.stringify({ result: false, error: "Failed to load SDK script", }); SendMessage("WebGL", "_SetupFailed", errorMessage); }; console.log("33333333333333333"); } catch (error) { console.log("444444444444444444"); console.error("[WebGL] Error during setup:", error); const errorMessage = JSON.stringify({ result: false, error: error.message, }); SendMessage("WebGL", "_SetupFailed", errorMessage); } }, 为什么 script.onload = function (){} 里面的代码不会执行??我打包为 webgl 在浏览器中都能正常运行,但是 Unity 中使用微信小游戏的一键打包导入微信小游戏之后就无法执行 script.onload = function (){} 里面的代码。。
04-01 - 小游戏现在不可以内置 webview 吗
现在微信小游戏中,可以内嵌浏览器吗? webview 的效果可以吗?
03-26 - 电脑端拉起微信小程序时显示未登录,但是已经是登录状态了,这是为什么?
背景: 电脑端拉起小程序后,显示图片内容,但是现在微信已经是登录状态。 [图片] 重新退出微信再登录之后才能正常拉起小程序。 问题: 是否是因为登录时间过长导致登录信息失效?如果是的话,登录信息的过期时间是多久? 如果不是的话,具体是什么原因呢?
03-03 - 在Unity中PC端怎么判断是否安装了微信?
因为没有集成 微信,无法使用微信的相关API。但是我想在 unity 中能够判断出该电脑是否安装了微信。我现在想到了查询注册表,但是无法确定注册表路径是否在各个电脑上都能够统一。还有其他的办法吗,比如说是否有什么系统的 API 可以直接判断。
02-19 - PC端怎么判断是否安装了微信?
想判断电脑上是否安装了微信,应该使用什么系统 API?使用注册表查询似乎无法做到准确查询。
02-17