logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class RestorePayloadPlanner

    Selects the shipped assets at hostage risk during an additive package upgrade and names their restore payloads. A shipped file is at hostage risk when its GUID appears in the PREVIOUS release's snapshot at a different path — a moved or renamed file: in an upgrading project the old copy still holds that GUID during import. Field evidence (a real import of the renamed package into a consumer project, confirmed via its Editor.log) shows the observed behavior on that GUID collision is typically a REDIRECT-WRITE — Unity writes the incoming content into the OLD path that already owns the GUID, updating it in place rather than creating the NEW path — though some import flows may instead silently skip the incoming file entirely. Either way the NEW path is never created by the import itself, which is exactly why this planner ships it a second time as a payload. Plain payload copies (.bytes) always import — no GUID can block them — which lets the cleaner restore the blocked files afterwards without a package re-import, regardless of which of the two observed behaviors actually occurred. Pure: no Unity API calls, so it is unit-testable without a running editor.

    Inheritance
    object
    RestorePayloadPlanner
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Editor.PackageBootstrapper
    Assembly: Serenity.PackageBootstrapper.Editor.dll
    Syntax
    public static class RestorePayloadPlanner

    Methods

    BuildPayloadName(int, string)

    Builds a flat, collision-free payload file name: a running index plus the target's file name, with the .bytes extension that guarantees Unity imports it as an opaque asset.

    Declaration
    public static string BuildPayloadName(int index, string targetPath)
    Parameters
    Type Name Description
    int index
    string targetPath
    Returns
    Type Description
    string

    SelectHostageRiskAssets(IReadOnlyList<ShippedAssetEntry>, IReadOnlyList<ShippedAssetEntry>, string)

    Declaration
    public static List<ShippedAssetEntry> SelectHostageRiskAssets(IReadOnlyList<ShippedAssetEntry> currentShippedEntries, IReadOnlyList<ShippedAssetEntry> previousSnapshotEntries, string payloadFolderPath)
    Parameters
    Type Name Description
    IReadOnlyList<ShippedAssetEntry> currentShippedEntries
    IReadOnlyList<ShippedAssetEntry> previousSnapshotEntries
    string payloadFolderPath
    Returns
    Type Description
    List<ShippedAssetEntry>

    SelectPayloadNamesToDelete(IEnumerable<string>, IEnumerable<string>)

    Selects exactly the payload file names on disk that the new plan no longer wants — never a name the plan still wants, even when that payload's content is about to change. This is what makes a regeneration additive/subtractive instead of destroy-and-rebuild: a payload the plan keeps is overwritten IN PLACE by Serenity.Editor.PackageBootstrapper.SerenityPackageExporter.WriteRestorePayload(System.Int32,Serenity.Editor.PackageBootstrapper.ShippedAssetEntry) (plain file bytes, no AssetDatabase.DeleteAsset), so its .meta — and therefore its GUID and any Addressables registration — is never disturbed. Deleting and recreating an unchanged payload would silently drop that registration, because Unity's own Addressables package removes an AddressableAssetEntry the moment its asset is deleted, and nothing re-adds it within the same synchronous regeneration. Pure: no Unity API calls, so it is unit-testable without a running editor.

    Declaration
    public static List<string> SelectPayloadNamesToDelete(IEnumerable<string> existingPayloadNames, IEnumerable<string> plannedPayloadNames)
    Parameters
    Type Name Description
    IEnumerable<string> existingPayloadNames
    IEnumerable<string> plannedPayloadNames
    Returns
    Type Description
    List<string>
    In this article
    © 2026 Serenity. All Rights Reserved