Detect the platform
Detect whether your scene is running on mobile, desktop, or web.
Available functions
import { getPlatform, isMobile, isDesktop, isWeb } from '@dcl/sdk/platform'Branch your UI by platform
import { isMobile, isDesktop } from '@dcl/sdk/platform'
function setupUI() {
if (isMobile()) {
// Larger buttons, simpler layout for touch
createMobileUI()
} else if (isDesktop()) {
// Denser layout tuned for keyboard and mouse
createDesktopUI()
}
}Checking the raw platform value
Related
Last updated