bool isPC = false;
//[Object wx.getDeviceInfo()](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getDeviceInfo.html)
var platform = WeChatWASM.WX.GetDeviceInfo().platform;
// Debug.Log("platform:" + platform);
//[Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfoSync.html)
//[wx.getSystemInfo](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfo.html) 的同步版本
var platform2 = WeChatWASM.WX.GetSystemInfoSync().platform;
// Debug.Log("platform2:" + platform2);
if (platform == "windows" || platform == "mac" || platform2 == "windows" || platform2 == "mac")
{
isPC = true;
}
//[Object wx.getDeviceInfo()](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getDeviceInfo.html) WeChatWASM.WX.GetDeviceInfo().platform; //[Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfoSync.html) //[wx.getSystemInfo](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfo.html) 的同步版本 WeChatWASM.WX.GetSystemInfoSync().platform;
获取platform平台字符串然后判断是windows 或 mac 则是电脑,否则是手机 或 其他设备
其他平台配置可自行测试打印出platform字符串得知 或百度查下

1841

被折叠的 条评论
为什么被折叠?



