Skip to content

@modoki/engine / index / gameIdFromScenePath

Function: gameIdFromScenePath()

gameIdFromScenePath(path): string | null

Derive a project id from a scene path by the games/<id>/ or demos/<id>/ project convention (the two project roots — see engine/scripts/projectRoots.mjs). Reliable under the dev server (unhashed asset URLs); returns null when the path doesn't carry a project segment (hashed production URLs, a standalone flat project whose assets serve at /assets, the menu, a prefab-edit world). Callers that know the id should pass opts.gameId instead of relying on this.

Parameters

path

string

Returns

string | null

Built with Modoki.