在 Gamemaker Studio 2 中,我如何在代码中找出平台是否为 HTML5?

In Gamemaker Studio 2 how can I find out in code whether the platform is HTML5 or not?

我希望能够 运行 或不 运行 代码,具体取决于我为哪个平台构建。 有些代码应该只 运行 用于 HTML5 平台。 我如何才能确定 运行 的平台是否在我的游戏制作者活动中 HTML5?

找到答案感谢:Charanor。 https://gamedev.stackexchange.com/questions/152719/in-gamemaker-studio-2-how-can-i-find-out-in-code-whether-the-platform-is-html5-o

您可以使用 os_browser 常量检查游戏当前 运行 在哪个浏览器中。如果游戏未在浏览器中 运行,则常量将为 browser_not_a_browser。因此,要检查它是否在浏览器中 运行 只需执行以下操作:

if os_browser != browser_not_a_browser {
     // Being run in a browser
}