Menu
Library allowing game developers to implement custom main menus for their games. These functions can be used for building game and addon selection UIs, and for loading into a game.
In most cases you won't need to build a game selection UI as the player will have already chosen your game from the engine's launcher menu.
Functions
Menu.loadGame
Flags to the engine that the selected game and addons should be loaded at the end of this tick.
Menu.loadGame()
Functions - Addons
Menu.listAddons
Lists all installed addons along with their metadata.
Menu.listAddons(): PackageMetadata[]
Returns
| Name | Type | Description |
|---|---|---|
| addons | PackageMetadata[] | List of addons. |
Menu.selectAddon
Selects an addon by its unique slug, to load when calling loadGame.
Menu.selectAddon(addon: string)
Parameters
| Name | Type | Default Value | Description |
|---|---|---|---|
| addon | string | Required | Unique slug of the addon to select. |
Menu.deselectAddon
Deselects an addon by its unique slug, to prevent loading when calling loadGame.
Menu.deselectAddon(addon: string)
Parameters
| Name | Type | Default Value | Description |
|---|---|---|---|
| addon | string | Required | Unique slug of the addon to deselect. |
Functions - Games
Menu.listGames
Lists all installed games along with their metadata.
Menu.listGames(): PackageMetadata[]
Returns
| Name | Type | Description |
|---|---|---|
| games | PackageMetadata[] | List of games. |
Menu.selectGame
Selects a game by its unique slug, to load when calling loadGame.
Menu.selectGame(game: string)
Parameters
| Name | Type | Default Value | Description |
|---|---|---|---|
| game | string | Required | Unique slug of the game to select. |
Menu.deselectGame
Deselects the selected game if one is selected.
Menu.deselectGame()
Types
PackageMetadata
Metadata for a game or addon, collectively referred to as a 'package'.
type PackageMetadata = { folder: string, slug: string, name: string, mountPath: string, coverImagePath: string }
Properties
| Field | Type | Description |
|---|---|---|
| folder | string | Real system path to the package's contents. |
| slug | string | Unique slug identifying this package. |
| name | string | Display name of the package. |
| mountPath | string | Virtual filesystem path where the content will be mounted. |
| coverImagePath | string | Path to a cover image. If the image can't be found, a suitable placeholder should be used. |