WuhuIslandTesting/Library/PackageCache/com.unity.scriptablebuildpipeline@1.21.5/Documentation~/UpgradeGuide.md

36 lines
5.2 KiB
Markdown
Raw Normal View History

2025-01-07 02:06:59 +01:00
# Upgrade Guide
To build your AssetBundles with the SBP package, use the `CompatibilityBuildPipeline.BuildAssetBundles` method wherever you used the [BuildPipeline.BuildAssetBundle](https://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundles.html) method.
**Note:** Not all of the features that were supported previously are supported in SBP.
The following tables list the features of the `CompatibilityBuildPipeline.BuildAssetBundles` method in comparison to the `BuildPipeline.BuildAssetBundle` method.
| Feature| Support | Notes |
|:---|:---|:---|
| AssetBundles| Supported | SBP builds AssetBundles built nearly identically to the previous build pipeline. You load them in a similar manner to how you currently load AssetBundles. |
| Incremental Building | Supported | SBP implements this feature using the new `BuildCache` class. |
| Asset loading path| Behavior changed | AssetBundles built with BuildPipeline today support loading an Asset by full path: *Assets/ExampleFolder/Asset.prefab*, file name: *Asset*, or file name with extension: *Asset.prefab*. However AssetBundles built with SBP by default only support loading an Asset by full path: *Assets/ExampleFolder/Asset.prefab*. This is to avoid loading collision that can occur if two Assets in the same AssetBundle have the different full paths, but the same file name. To change this behavior, the loading path can be set using `IBundleBuildContent.Addresses` with the `ContentPipeline.BuildAssetBundles` API or use the [AssetBundleBuild.addressableNames](https://docs.unity3d.com/ScriptReference/AssetBundleBuild-addressableNames.html) field. See [Usage Examples](UsageExamples.md). |
| AssetBundle Manifest | Behavior changed | SBP does not write an AssetBundle storing the AssetBundleManifest object. SBP implements replacement functionality with the class `CompatibilityAssetBundleManifest`. This has an identical API to the existing [AssetBundleManifest](https://docs.unity3d.com/ScriptReference/AssetBundleManifest.html) class, plus the addition of a method to get the CRC value for a bundle.|
| AssetBundle .manifest files | Behaviour changed | Builds performed with BuildPipeline.BuildAssetBundles output YAML-format files with the .manifest file extension that describe the content of each AssetBundle. SBP does not write .manifest files for individual AssetBundles. When CompatibilityBuildPipeline is used, SBP will serialize the CompatibilityAssetBundleManifest object to a .manifest with filename matching the build folder name. This file has similar, but not identical, content to the top level .manifest file that is generated by BuildPipeline.BuildAssetBundles. |
| Code Stripping | Behaviour changed | SBP does not generate the .manifest file content that can be used in conjunction with [BuildPlayerOptions.assetBundleManifestPath](https://docs.unity3d.com/ScriptReference/BuildPlayerOptions-assetBundleManifestPath.html) to prevent Player builds from stripping out types that are only used in AssetBundles. Instead SBP supports generating an link.xml to achieve the same result.|
| Build Report | Not supported | SBP does not generate a [BuildReport](https://docs.unity3d.com/ScriptReference/Build.Reporting.BuildReport.html) file. |
| AssetBundle Variants| Not supported | There is currently no replacement functionality for AssetBundle Variants. |
| Build Callbacks | Supported | SBP supports invoking the [IProcessSceneWithReport](https://docs.unity3d.com/ScriptReference/Build.IProcessSceneWithReport.html) and IPreprocessShaders build callbacks. |
BuildAssetBundleOptions Enum:
| Value| Support | Notes |
|:---|:---|:---|
| UncompressedAssetBundle| Supported | Identical to using `BuildCompression.DefaultUncompressed`. |
| ChunkBasedCompression | Supported | Identical to using `BuildCompression.DefaultLZ4`. **Note:** This has always been LZ4HC in the Editor, and LZ4 if it was recompressed at Runtime. |
| DisableWriteTypeTree | Supported | Identical to using `ContentBuildFlags.DisableWriteTypeTree`. |
| DeterministicAssetBundle | Supported | This is enabled by default, and it cant be disabled. SBP builds deterministically. |
| ForceRebuildAssetBundle | Supported | Identical to using `IBuildParameters.UseCache = false;`. |
| AppendHashToAssetBundleName | Supported | Identical to using `IBundleBuildParameters.AppendHash = true;`. |
| DisableLoadAssetByFileName | Always enabled | This is enabled by default, and cant be disabled. SBP is strict about the rule: "what you pass in is exactly what you get out". If you pass in *My/Example1/Example2/Asset.asset* as the file name to use to load the Asset, you must use that identifier exactly, including the correct upper and lower case, and all punctuation. |
| DisableLoadAssetByFileNameWithExtension | Always enabled | See above details on DisableLoadAssetByFileName. |
| IgnoreTypeTreeChanges | Not supported | The incremental build system used this value to prevent rebuilding AssetBundles when an Asset's serialization layout changed, but the data for the Asset itself did not change. SBP currently rebuilds if there are any changes. |
| StrictMode | Not supported | The SBP is stricter about properly building AssetBundles and knowing when builds fail. |
| DryRunBuild | Not supported | SBP works fundamentally differently. It is faster to do a full build to determine if anything has changed. |