Class UnitySystemConfigurationService
Main orchestrator service that manages system configuration collection and monitoring.
Determines WHEN to collect system information (startup, focus changes, resolution changes, polling) and delegates the WHAT to providers and WHERE to stores.
Implements multiple interfaces to maintain compatibility while providing comprehensive system configuration management.
Manages automatic collection on Unity lifecycle events and periodic polling based on configuration settings.
Inheritance
UnitySystemConfigurationService
Assembly: Serenity.UnitySystemConfiguration.Infrastructure.dll
Syntax
public class UnitySystemConfigurationService : MonoBehaviour, ISystemConfigurationService, ISystemConfigurationProvider, ISystemConfigurationSnapshotStore, IService, IFoundationSettings
Constructors
UnitySystemConfigurationService()
Declaration
public UnitySystemConfigurationService()
Fields
_gameSettings
Declaration
protected IGameSettingsService _gameSettings
Field Value
_guid
Declaration
Field Value
_id
Declaration
Field Value
_logService
Declaration
protected ILogService _logService
Field Value
_pollCoroutine
Declaration
protected Coroutine _pollCoroutine
Field Value
| Type |
Description |
| Coroutine |
|
_provider
Declaration
protected ISystemConfigurationProvider _provider
Field Value
_settingsSO
Declaration
protected UnitySystemConfigurationSettings _settingsSO
Field Value
_typedSettings
Declaration
protected ISystemConfigurationSettings _typedSettings
Field Value
_wasFocused
Declaration
protected bool _wasFocused
Field Value
Properties
CurrentSnapshot
Gets the current system configuration snapshot from the internal store.
Returns null if no snapshot has been collected yet or if the store is not initialized.
Declaration
public ISystemConfigurationSnapshot CurrentSnapshot { get; }
Property Value
Guid
Unique GUID for the settings instance.
Declaration
public string Guid { get; set; }
Property Value
Id
Unique identifier for the settings instance.
Declaration
public string Id { get; set; }
Property Value
LogService
Log service used for diagnostic output and error reporting.
Declaration
public ILogService LogService { get; set; }
Property Value
Methods
GetSnapshot()
Gets a new system configuration snapshot by delegating to the internal provider.
Returns comprehensive system information including culture, hardware, and display data with privacy protection applied.
Declaration
public virtual ISystemConfigurationSnapshot GetSnapshot()
Returns
InitializeGameSettings(IGameSettingsService)
Optional injection method for game settings service integration.
Enables automatic synchronization of system configuration data with game settings when snapshots are collected.
Can be called after service initialization to add game settings synchronization functionality.
Declaration
public void InitializeGameSettings(IGameSettingsService gameSettingsService)
Parameters
| Type |
Name |
Description |
| IGameSettingsService |
gameSettingsService |
Game settings service for automatic synchronization
|
InitializeService(ISystemConfigurationSettings, ILogService)
Initializes the system configuration service with settings and logging dependencies.
Creates and configures internal providers, stores, and detectors based on the provided settings.
Applies platform guards to disable the service on unsupported platforms.
Automatically triggers startup collection and begins polling if configured to do so.
Declaration
public virtual void InitializeService(ISystemConfigurationSettings settings, ILogService logService)
Parameters
| Type |
Name |
Description |
| ISystemConfigurationSettings |
settings |
System configuration settings controlling service behavior
|
| ILogService |
logService |
Logging service for diagnostic output and error reporting
|
SetAsync(ISystemConfigurationSnapshot, CancellationToken)
Stores a system configuration snapshot asynchronously by delegating to the internal store.
Handles persistence, game settings synchronization, and logging as configured in the service settings.
Declaration
public virtual Task SetAsync(ISystemConfigurationSnapshot snapshot, CancellationToken cancellationToken)
Parameters
Returns
| Type |
Description |
| Task |
Task representing the async storage operation
|
Implements