Class PrefetchPolicyCreator
Generates (or updates) a PrefetchPolicyRegistry asset and the set of
PrefetchPolicyProfile assets it references, from a single description. Mirrors
Serenity.GameCamera.Infrastructure.Editor.Builder.GameCameraSettingsCreator: static class,
Input/Result DTOs, Validate, Create with created-paths rollback on failure — resolved and
folder-provisioned through the shared SettingsAssetAuthoring engine rather than a private
copy of its logic.
Unlike the registry — a single project-wide asset resolved the same way
Serenity.GameCamera.Infrastructure.Settings.UnityGameCameraSettings is — the profiles are a
set of N assets. Each row resolves to an existing PrefetchPolicyProfile asset with a
matching Id already living in ProfilesFolderPath
(updated in place) or a brand-new asset created there.
CreatePrefetchPolicyWindow only collects input and renders results; every asset mutation
lives here.
Inheritance
PrefetchPolicyCreator
Assembly: Serenity.UnityAssetPrefetcher.Infrastructure.Editor.dll
Syntax
public static class PrefetchPolicyCreator
Fields
DefaultOutputFolder
Folder brand-new profile/registry assets are created under when the caller names none.
Declaration
public const string DefaultOutputFolder = "Assets/Game/Media/AssetPrefetcher"
Field Value
DefaultProfileId
The Id the registry's GetDefault() looks up.
Declaration
public const string DefaultProfileId = "default"
Field Value
ProfileAssetFileNameFallback
Fallback file name for a brand-new profile asset when a Id sanitizes
to nothing usable.
Declaration
public const string ProfileAssetFileNameFallback = "PrefetchPolicyProfile"
Field Value
RegistryAssetFileNameFallback
Fallback (and only) file name for a brand-new registry asset — the registry carries no
authored "name" field, so this is always the resolved file name when RegistryAssetPath
is empty.
Declaration
public const string RegistryAssetFileNameFallback = "PrefetchPolicyRegistry"
Field Value
RuntimeMinimumMaxSizeMB
The runtime service floor-clamps the memory budget to this many megabytes.
Declaration
public const int RuntimeMinimumMaxSizeMB = 16
Field Value
Methods
Validates the request, then resolves-or-creates the registry and every profile row, and applies
every field. On any failure every mutation is rolled back through the transaction's existing-asset
restores: created assets/folders are deleted, their Addressables entries removed, and any
already-existing registry/profile that was being edited has its pre-call field values restored.
Declaration
public static PrefetchPolicyCreator.Result Create(PrefetchPolicyCreator.Input input)
Parameters
Returns
Computes what Create(Input) would do without mutating the project — the same
resolution helpers, read-only.
Declaration
public static PrefetchPolicyCreator.PreviewResult Preview(PrefetchPolicyCreator.Input input)
Parameters
Returns
ResolveRegistryContext(string)
Thin wrapper over the shared ResolveSettingsContext<TSettings>(string, string),
exposed so CreatePrefetchPolicyWindow can auto-detect the project-wide singleton for
its "Edit existing" field. A second (or later) PrefetchPolicyRegistry asset does not
break anything at runtime — the composition root's serialized field is assigned by hand, not
discovered — so ambiguity here is surfaced as a warning (see Serenity.AssetPrefetcher.Infrastructure.Editor.Builder.PrefetchPolicyCreator.ValidateRegistryResolution(Serenity.AssetPrefetcher.Infrastructure.Editor.Builder.PrefetchPolicyCreator.Input,Serenity.StructuredPersistence.Infrastructure.Editor.Authoring.SettingsAssetAuthoring.SettingsResolution{Serenity.AssetPrefetcher.Infrastructure.Settings.PrefetchPolicyRegistry},Serenity.Global.Infrastructure.Editor.SerenityCreationValidationResult)),
never a hard error.
Declaration
public static SettingsAssetAuthoring.SettingsResolution<PrefetchPolicyRegistry> ResolveRegistryContext(string explicitRegistryAssetPath = "")
Parameters
| Type |
Name |
Description |
| string |
explicitRegistryAssetPath |
|
Returns
Validates the request: at least one profile row, exactly one profile with
DefaultProfileId, unique Ids (case-insensitively — they become file names) that are
each non-empty, a positive MaxSizeMB on every row (a warning when it is
below RuntimeMinimumMaxSizeMB — the runtime clamps it rather than rejecting it), and a
well-formed destination folder. Also warns (never blocks) when: the 'default' row is not listed
first (Create(Input) reorders it to the front regardless); a project-wide registry search
turns up more than one existing asset — see the resolve-or-edit note on
ResolveRegistryContext(string); or an existing registry references profiles that will be
unlinked because they are not among the authored rows.
Declaration
public static SerenityCreationValidationResult Validate(PrefetchPolicyCreator.Input input)
Parameters
Returns
| Type |
Description |
| SerenityCreationValidationResult |
|