Dedicated Server AssetBundles
Describes how to create AssetBundles optimized for Dedicated Server builds.
Read time 1 minuteLast updated 20 days ago
You can apply the Dedicated Server optimizations to AssetBundles starting in Unity Editor version 2023.1.0a21. You can build an AssetBundle through scripting. Refer to the section on AssetBundle for more information on building AssetBundles in general.
To build an AssetBundle to undergo the same Dedicated Server optimizations as discussed for the Player, specify the field in the struct to be when calling the method. Refer to the following example:
subtargetBuildAssetBundlesParametersStandaloneBuildSubtarget.ServerBuildAssetBundleBuildAssetBundlesParameters serverAssetBundleParameters ={ outputPath = /*some example asset path here, not entirely relevant*/, options = BuildAssetBundleOptions.None, targetPlatform = BuildTarget.StandaloneWindows64, //alternately, the MacOS or Linux build targets, any desktop platform subtarget = StandaloneBuildSubtarget.Server};BuildPipeline.BuildAssetBundles(serverAssetBundleParameters);
After you build the AssetBundle, you can load it by a Player at runtime. Refer to Using AssetBundles Natively.