Skip to content

Game.Settings.GeneralSettings

Assembly: Game
Namespace: Game.Settings

Type: class

Base: Setting

Summary:
GeneralSettings represents the game's general configuration exposed to the settings UI. It covers FPS display mode, autosave configuration (interval and count), asset database auto-reload mode, simulation performance preference, and optional telemetry consent integration with the PdxSdk platform. The class uses several SettingsUI attributes to control presentation and behavior in the settings UI and integrates with runtime systems (AssetDatabase, SimulationSystem, AutoSaveSystem, PdxSdkPlatform) to apply changes immediately where appropriate.


Enums (defined inside GeneralSettings)

  • FPSMode
  • Off, Simple, Advanced, Precise — controls the in-game FPS display mode.

  • AutoSaveCount

  • One = 1, Three = 3, Ten = 10, Fifty = 50, Hundred = 100, Unlimited = 0 — number of autosaves to keep.

  • AutoSaveInterval

  • OneMinute = 60, TwoMinutes = 120, FiveMinutes = 300, TenMinutes = 600, ThirtyMinutes = 1800, OneHour = 3600 — autosave intervals in seconds.

Fields

  • private AssetDatabase.AutoReloadMode m_AssetDatabaseAutoReloadMode
    This backing field stores the selected AssetDatabase auto-reload mode. The property setter for assetDatabaseAutoReloadMode also synchronizes the value with AssetDatabase.global.autoReloadMode.

  • private SimulationSystem.PerformancePreference m_PerformancePreference
    Backing field for performancePreference. When the property is changed, the current SimulationSystem (if available) is updated to reflect the new preference.

  • private PdxSdkPlatform m_Manager
    Holds a reference to the PdxSdkPlatform integration (if available) used to query and set telemetry consent choices and to determine whether telemetry consent should be presented.

  • private bool m_OptionalTelemetryConsentFaulted
    Tracks whether a recent attempt to set the optional telemetry consent failed, used to show a warning in the settings UI.

Properties

  • public AssetDatabase.AutoReloadMode assetDatabaseAutoReloadMode { get; set; }
    Setting-controlled property (SettingsUIPlatform attribute restricts visibility) that gets/sets m_AssetDatabaseAutoReloadMode. Setting this property also updates AssetDatabase.global.autoReloadMode so the engine's asset auto-reload behavior changes immediately.

  • public SimulationSystem.PerformancePreference performancePreference { get; set; }
    When set, updates the m_PerformancePreference backing field and, if a SimulationSystem exists in the default world, sets its performancePreference to the new value immediately.

  • public FPSMode fpsMode { get; set; }
    Developer-exposed property for choosing the FPS display mode (Off/Simple/Advanced/Precise).

  • public bool autoSave { get; set; }
    Toggle for enabling/disabling autosave in the general settings UI.

  • public AutoSaveInterval autoSaveInterval { get; set; }
    Autosave interval selection. This property is decorated with SettingsUIDisableByCondition so it may be disabled in the UI depending on the AutoSaveEnabled condition.

  • public AutoSaveCount autoSaveCount { get; set; }
    How many autosaves to keep. Also decorated with SettingsUIDisableByCondition to reflect UI enable/disable logic.

  • public bool autoSaveNow { get; set; }
    Decorated as a SettingsUIButton (developer-visible) and disabled by the "CanSave" condition. The getter always returns true. Writing to this property triggers an immediate autosave if the current game mode allows it: it fetches or creates the AutoSaveSystem and calls PerformAutoSave(this). Use this to expose a "Save Now" button in the UI.

  • public bool allowOptionalTelemetry { get; set; }
    Excluded from some serialization (marked with [Exclude]) and decorated to hide based on HideTelemetryConsentChoice and to show a warning when TelemetryConsentFaulted() returns true. The getter queries m_Manager?.GetTelemetryConsentChoice() (false if manager is null). The setter calls the private SetTelemetryConsentChoice(bool) helper if m_Manager is available.

  • public bool resetSettings { set; }
    Exposed as a SettingsUIButton with confirmation attributes. Setting this property invokes GameManager.instance.settings.Reset(), resetting settings to defaults.

Constructors

  • public GeneralSettings()
    Initializes a new instance, calls SetDefaults() to populate default values for all properties, and calls InitializePlatform() to wire up PdxSdkPlatform integration (listening for platform registration events).

Methods

  • public override void SetDefaults()
    Sets sensible default values for general settings:
  • autoSave = false
  • autoSaveInterval = AutoSaveInterval.FiveMinutes
  • autoSaveCount = AutoSaveCount.Three
  • fpsMode = FPSMode.Off
  • assetDatabaseAutoReloadMode = AssetDatabase.AutoReloadMode.None
  • performancePreference = SimulationSystem.PerformancePreference.Balanced

  • public static bool CanSave()
    Returns whether the "save now" button should be enabled; implemented as the negation of GameManager.instance.gameMode.IsGameOrEditor(). If the game is in "game or editor" mode this function returns false (button disabled).

  • public static bool AutoSaveEnabled()
    Evaluates whether autosave UI controls should be disabled/enabled. Note: the method returns !SharedSettings.instance.general.autoSave — i.e. it negates the stored autoSave field. This logic is used by the SettingsUIDisableByCondition attributes in the UI; be aware of the inversion when reading the code.

  • private async void SetTelemetryConsentChoice(bool allow)
    Asynchronously attempts to set the telemetry consent choice via m_Manager.SetTelemetryConsentChoice(allow). On failure (await returns false) it sets m_OptionalTelemetryConsentFaulted = true and shows a MessageDialog via GameManager.instance.userInterface.appBindings.ShowMessageDialog(...) with keys "Paradox.TELEMETRY_CONSENT_ERROR_TITLE" and "Paradox.TELEMETRY_CONSENT_ERROR_DESCRIPTION". On success m_OptionalTelemetryConsentFaulted is false.

  • private bool HideTelemetryConsentChoice()
    Returns true if telemetry consent UI should be hidden. If m_Manager exists it returns the negation of m_Manager.IsTelemetryConsentPresentable(); if m_Manager is null it returns true (hide).

  • private bool TelemetryConsentFaulted()
    Returns the boolean m_OptionalTelemetryConsentFaulted used to conditionally show a warning in the settings UI.

  • private void InitializePlatform()
    Attempts to get the PdxSdkPlatform from PlatformManager.instance and assigns it to m_Manager. Also subscribes to PlatformManager.instance.onPlatformRegistered to capture the manager if it gets registered later.

Usage Example

// Access the active general settings instance and change common options
var general = GameManager.instance.settings.general;

// Enable autosave, set interval and count
general.autoSave = true;
general.autoSaveInterval = GeneralSettings.AutoSaveInterval.TenMinutes;
general.autoSaveCount = GeneralSettings.AutoSaveCount.Ten;

// Apply a performance preference (the property will update the SimulationSystem if present)
general.performancePreference = SimulationSystem.PerformancePreference.Balanced;

// Trigger an immediate save via the UI-exposed button property (invokes AutoSaveSystem.PerformAutoSave)
general.autoSaveNow = true;

// Reset to defaults (invokes GameManager.instance.settings.Reset())
general.resetSettings = true;

Notes and modding tips: - Changing assetDatabaseAutoReloadMode will immediately update AssetDatabase.global.autoReloadMode; use with caution during runtime. - The allowOptionalTelemetry property relies on the PdxSdkPlatform being available; InitializePlatform attempts to wire this up during construction and listens for platform registration. - UI-related attributes (SettingsUIButton, SettingsUIDisableByCondition, SettingsUIHideByCondition, etc.) control how these properties are presented in the built settings UI—review them if you are extending or localizing the settings UI. - Be careful with the AutoSaveEnabled method's negated logic when adding new UI conditions or debugging disabled controls.