For the complete documentation index, see llms.txt. This page is also available as Markdown.

Detect the platform

Detect whether your scene is running on mobile, desktop, or web.

Use the isMobile() function to adapt your UI, controls, and gameplay specifically for mobile. This is the recommended way to deliver a great experience across all clients without forking your scene logic entirely.

Available functions

import { getPlatform, isMobile, isDesktop, isWeb } from '@dcl/sdk/platform'
  • getPlatform() — returns the current platform as 'mobile' | 'desktop' | 'web' | null. Returns null until the explorer has reported its platform back to the scene (this happens shortly after the scene starts).

  • isMobile() — returns true if the player is on the mobile client.

  • isDesktop() — returns true if the player is on the desktop client.

  • isWeb() — returns true if the player is on the web client.

Branch your UI by platform

A common pattern is to set up a different UI for mobile and desktop players:

You can also use the same pattern to:

  • Show or hide on-screen instructions tailored to each input method.

  • Replace small clickable elements with larger touch targets on mobile.

  • Disable input bindings that are not easily available on mobile (see Input on mobile).

Checking the raw platform value

If you need to handle multiple platforms in a single switch, use getPlatform():

Last updated