Skip to main content

Game Configuration

The game.json file in the Mini Game root directory is used to configure to Mini Games. The file content is a JSON object with the following properties:

Configuration Items

PropertyTypeDefault ValueRequiredDescription
deviceOrientationstringportrait-Screen orientation
showStatusBarBooleanfalse-Specifies whether to display the status bar
subPackagesObject[]--subPackage structure configuration.

Valid values of deviceOrientation

ValueDescription
portraitPortrait mode. The screen does not rotate as the phone rotates.
landscapeLandscape mode. The screen rotates as the phone rotates in the landscape mode.

subPackages

In some cases, the developer needs to divide a Mini Game into different child packages, and package these child packages into different subpackages while building, so that users can load them as needed.

When building a subpackage project, one or more subpackages will be output. Each subpackaged Mini Game must contain a main package that includes the game startup logic and some common resources and JS scripts required by all subpackages. The sub-packages are divided according to the developer's configuration.

When the Mini Game starts, the main package is downloaded and game.js in the main package are started by default. You can load the subpackages by calling the bn.loadSubpackage API.

Supported from SDK ^3.2.0, IDE ^2.9.0 and Native ^2.40.0

PropertyTypeDefault ValueRequiredDescription
rootstringroot of subPackage
namestringalias name