Game Settings
Game Settings infrastructure is used to prepare the Flax options for the built game. By using game settings you can set the initial game scene, link your plugin runtime options or more. This section covers the main concept of game settings and documents the related asset types.
Root asset
In order to provide more universal design and unify the project's structure, the game settings asset is always located in Content/GameSettings.json
. This file is in json format and contains the basic game description (product name, company, etc.) and references other assets (time settings, layers and tags, etc.).
Example game settings file can be found here. By default all Flax samples and templates contain a proper game settings to use.
Creating settings
You can use the Content window to create new settings. Simply right-click in the Content folder and select option New -> Settings, specify its name and press Enter. Then select the new asset type. Game settings asset or any other settings asset is normal Json resource so you can rename/move/edit them like other asset types. It's highly recommended to use a version control system for settings as they are text files and should be versioned when working in a team.
Properties
Property | Description |
---|---|
Product Name | The name of your game. |
Company Name | The name of your company or organization. |
Copyright Notice | The copyright note used for content signing (eg. source code header). |
Icon | The default application icon. Can be overridden per platform. |
FirstScene | Reference to the first scene to load on a game startup. |
No Splash Screen | True if skip showing splash screen image on the game startup. |
Splash Screen | Reference to the splash screen image to show on a game startup. |
Time | Reference to Time Settings asset. Contains initial time manager options. |
Audio | Reference to Audio Settings asset. Contains initial audio playback engine options. |
Layers And Tags | Reference to Layers And Tags Settings asset. Contains actors tags and layer names used in your game. |
Physics | Reference to Physics Settings asset. Contains physics simulation options. |
Input | Reference to Input Settings asset. Contains initial virtual input layout. |
Graphics | Reference to Graphics Settings asset. Contains initial rendering options. |
Navigation | Reference to Navigation Settings asset. Contains initial navmesh building options. |
Game Cooking | Reference to Build Settings asset. Contains Game Cooker profiles and additional options used during games building. |
Streaming | Reference to Streaming Settings asset. Contains resources streaming configuration such as Texture Groups options. |
Custom Settings | Collection of custom json assets used by the game and plugins. To learn more see the related documentation here. |
Windows | Reference to Windows Settings asset. Contains options used when building game for Windows. |
PlayStation 4 | Reference to PlayStation 4 Settings settings. Contains options used when building game for PlayStation 4. |
PlayStation 5 | Reference to PlayStation 5 Settings settings. Contains options used when building game for PlayStation 5. |
Xbox Scarlett | Reference to Xbox Scarlett Settings settings. Contains options used when building game for Xbox Scarlett. |
Switch | Reference to Switch Settings settings. Contains options used when building game for Switch. |
macOS | Reference to macOS asset. Contains options used when building game for macOS. |
iOS | Reference to iOS asset. Contains options used when building game for iOS. |
Accessing settings at runtime
Example code to access game settings data in game code.
using FlaxEditor.Content.Settings;
using FlaxEngine;
public class TestSettingsUsage : Script
{
public override void OnEnable()
{
var gameSettings = GameSettings.Load();
Debug.Log("Game name: " + gameSettings.ProductName);
var timeSettings = GameSettings.Load<TimeSettings>();
Debug.Log("Draw FPS from settings: " + timeSettings.DrawFPS);
}
}