logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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
    object
    PrefetchPolicyCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.AssetPrefetcher.Infrastructure.Editor.Builder
    Assembly: Serenity.UnityAssetPrefetcher.Infrastructure.Editor.dll
    Syntax
    public static class PrefetchPolicyCreator

    Fields

    DefaultProfileId

    The Id the registry's GetDefault() looks up.

    Declaration
    public const string DefaultProfileId = "default"
    Field Value
    Type Description
    string

    RuntimeMinimumMaxSizeMB

    The runtime service floor-clamps the memory budget to this many megabytes.

    Declaration
    public const int RuntimeMinimumMaxSizeMB = 16
    Field Value
    Type Description
    int

    Methods

    Create(Input)

    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: 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
    Type Name Description
    PrefetchPolicyCreator.Input input
    Returns
    Type Description
    PrefetchPolicyCreator.Result

    Preview(Input)

    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
    Type Name Description
    PrefetchPolicyCreator.Input input
    Returns
    Type Description
    PrefetchPolicyCreator.PreviewResult

    Validate(Input)

    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 Serenity.AssetPrefetcher.Infrastructure.Editor.Builder.PrefetchPolicyCreator.ResolveRegistryContext(Serenity.AssetPrefetcher.Infrastructure.Editor.Builder.PrefetchPolicyCreator.Input); 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
    Type Name Description
    PrefetchPolicyCreator.Input input
    Returns
    Type Description
    SerenityCreationValidationResult
    In this article
    © 2026 Serenity. All Rights Reserved