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.
Implements
Namespace: Serenity.SystemConfiguration.Infrastructure.Services
Assembly: Serenity.UnitySystemConfiguration.Infrastructure.dll
Syntax
public class UnitySystemConfigurationService : MonoBehaviour, ISystemConfigurationService, ISystemConfigurationProvider, ISystemConfigurationSnapshotStore, IFoundationSettings
Constructors
UnitySystemConfigurationService()
Declaration
public UnitySystemConfigurationService()
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
| Type | Description |
|---|---|
| ISystemConfigurationSnapshot | Current system configuration snapshot or null |
Guid
Unique GUID for the settings instance.
Declaration
public string Guid { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
Unique identifier for the settings instance.
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
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 ISystemConfigurationSnapshot GetSnapshot()
Returns
| Type | Description |
|---|---|
| ISystemConfigurationSnapshot | Complete system configuration snapshot with configured privacy protections |
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 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 Task SetAsync(ISystemConfigurationSnapshot snapshot, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ISystemConfigurationSnapshot | snapshot | System configuration snapshot to store |
| CancellationToken | cancellationToken | Cancellation token for async operation control |
Returns
| Type | Description |
|---|---|
| Task | Task representing the async storage operation |