Class UnityGameSettingsAssetPreloaderFactory
Factory for creating and configuring UnityGameSettingsAssetPreloader instances.
Implements domain contracts by creating preloaders that integrate with the progressive asset preloading system,
supporting both standalone preloaders and menu-integrated preloading workflows with validation and logging.
Implements
Inherited Members
Namespace: Serenity.GameSettings.Infrastructure.Factories
Assembly: Serenity.UnityGlobal.Infrastructure.dll
Syntax
public class UnityGameSettingsAssetPreloaderFactory : IGameSettingsAssetPreloaderFactory
Constructors
UnityGameSettingsAssetPreloaderFactory(ILogService)
Declaration
public UnityGameSettingsAssetPreloaderFactory(ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogService | logService |
Methods
Create(IFoundationViewElement, ILogService, object, IGameSettingsService)
Creates a UnityGameSettingsAssetPreloader instance attached to the specified host element.
Initializes with optional dependencies for asset prefetching and game settings management.
If dependencies are not provided, attempts to resolve them internally (may result in limited functionality
Declaration
public IGameSettingsAssetPreloader Create(IFoundationViewElement host, ILogService logService, object assetPrefetcher = null, IGameSettingsService gameSettingsService = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IFoundationViewElement | host | Host foundation view element to attach the preloader to |
| ILogService | logService | Logging service for diagnostic output |
| object | assetPrefetcher | Optional asset prefetcher service instance |
| IGameSettingsService | gameSettingsService | Optional game settings service instance |
Returns
| Type | Description |
|---|---|
| IGameSettingsAssetPreloader | Configured UnityGameSettingsAssetPreloader instance |
CreateForMenu(IFoundationViewElement, string, ILogService)
Creates a UnityGameSettingsAssetPreloader specifically for menu contexts.
Utilizes CreateWithIntegration to set up both the preloader and integrator on the host element.
Declaration
public IGameSettingsAssetPreloader CreateForMenu(IFoundationViewElement host, string menuId, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IFoundationViewElement | host | Host foundation view element representing the menu |
| string | menuId | Identifier for the menu (for logging purposes) |
| ILogService | logService | Logging service for diagnostic output |
Returns
| Type | Description |
|---|---|
| IGameSettingsAssetPreloader | Configured UnityGameSettingsAssetPreloader instance for the menu |
CreateWithIntegration(IFoundationViewElement, ILogService)
Creates a UnityGameSettingsAssetPreloader with integrated menu asset preloading.
Attaches both the preloader and a MenuAssetPreloadingIntegrator to the specified host element.
Declaration
public (IGameSettingsAssetPreloader preloader, IGameSettingsAssetPreloadingIntegrator integrator) CreateWithIntegration(IFoundationViewElement host, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IFoundationViewElement | host | Host foundation view element to attach the preloader and integrator to |
| ILogService | logService | Logging service for diagnostic output |
Returns
| Type | Description |
|---|---|
| (IGameSettingsAssetPreloader preloader, IGameSettingsAssetPreloadingIntegrator integrator) | Tuple containing the preloader and integrator instances |
ValidateDependencies()
Validates that all required dependencies for creating a functional preloader are available.
Checks for the presence of IAssetPrefetcher and IGameSettingsService instances.
Logs the validation result for diagnostic purposes.
Declaration
public bool ValidateDependencies()
Returns
| Type | Description |
|---|---|
| bool | True if all dependencies are available, false otherwise |