Table of Contents

Class AssetMigration

Namespace
Stride.Core.Assets
Assembly
Stride.Core.Assets.dll

Helper for migrating asset to newer versions.

public static class AssetMigration
Inheritance
object
AssetMigration

Methods

MigrateAssetIfNeeded(AssetMigrationContext, PackageLoadingAssetFile)

Migrates the asset for each format key its type declares (AssetFormatVersionAttribute): the engine's first, then the others, such as a plugin's own. A key other than the engine's that the file records no version for is skipped: the asset predates it, and no upgrader starts from nothing.

public static bool MigrateAssetIfNeeded(AssetMigrationContext context, PackageLoadingAssetFile loadAsset)

Parameters

context AssetMigrationContext
loadAsset PackageLoadingAssetFile

Returns

bool

Whether the asset was migrated for any key.

MigrateAssetIfNeeded(AssetMigrationContext, PackageLoadingAssetFile, string, PackageVersion?)

public static bool MigrateAssetIfNeeded(AssetMigrationContext context, PackageLoadingAssetFile loadAsset, string dependencyName, PackageVersion? untilVersion = null)

Parameters

context AssetMigrationContext
loadAsset PackageLoadingAssetFile
dependencyName string
untilVersion PackageVersion

Returns

bool

MigrateAssetIfNeeded(AssetMigrationContext, IReadOnlyList<ParsingEvent>, UFile, Type)

Migrates an asset held as YAML parsing events (the way an unloadable asset keeps the YAML read from its file) as MigrateAssetIfNeeded(AssetMigrationContext, PackageLoadingAssetFile) migrates a file, for every format key its type declares.

public static List<ParsingEvent>? MigrateAssetIfNeeded(AssetMigrationContext context, IReadOnlyList<ParsingEvent> parsingEvents, UFile filePath, Type assetType)

Parameters

context AssetMigrationContext
parsingEvents IReadOnlyList<ParsingEvent>
filePath UFile

The asset's file, whose extension selects the serializer.

assetType Type

The type the events deserialize to: the asset's root carries no tag when serialized as that type.

Returns

List<ParsingEvent>

The migrated events, in the same shape (a whole document or not); null when there was nothing to migrate.