Class AssetMigration
Helper for migrating asset to newer versions.
public static class AssetMigration
- Inheritance
-
objectAssetMigration
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
contextAssetMigrationContextloadAssetPackageLoadingAssetFile
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
contextAssetMigrationContextloadAssetPackageLoadingAssetFiledependencyNamestringuntilVersionPackageVersion
Returns
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
contextAssetMigrationContextparsingEventsIReadOnlyList<ParsingEvent>filePathUFileThe asset's file, whose extension selects the serializer.
assetTypeTypeThe 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.