Class AssetPrefetcherLocator
Scene-based locator and holder for the IAssetPrefetcher service instance.
Provides static events to notify when the service becomes available or is cleared.
Implements
Namespace: Serenity.AssetPrefetcher.Infrastructure.Services
Assembly: Serenity.UnityAssetPrefetcher.Infrastructure.dll
Syntax
public class AssetPrefetcherLocator : MonoBehaviour, IAssetPrefetcherProvider
Constructors
AssetPrefetcherLocator()
Declaration
public AssetPrefetcherLocator()
Methods
Clear()
Clears the current service and notifies listeners.
Declaration
public void Clear()
Set(IAssetPrefetcherService)
Sets the asset prefetcher service and notifies listeners.
Declaration
public void Set(IAssetPrefetcherService service)
Parameters
| Type | Name | Description |
|---|---|---|
| IAssetPrefetcherService | service | The asset prefetcher service to set |
TryGet(out IAssetPrefetcherService)
Attempts to retrieve the current asset prefetcher service.
Declaration
public bool TryGet(out IAssetPrefetcherService prefetcher)
Parameters
| Type | Name | Description |
|---|---|---|
| IAssetPrefetcherService | prefetcher | The asset prefetcher service if available, null otherwise |
Returns
| Type | Description |
|---|---|
| bool | True if a service is available, false otherwise |
Events
OnServiceCleared
Declaration
public static event Action OnServiceCleared
Event Type
| Type | Description |
|---|---|
| Action | Fired when the service is cleared (set to null). |
OnServiceSet
Declaration
public static event Action<IAssetPrefetcherService> OnServiceSet
Event Type
| Type | Description |
|---|---|
| Action<IAssetPrefetcherService> | Fired when a service is set (non-null value). |