Complete the code to load an asset bundle from a file path.
AssetBundle bundle = AssetBundle.LoadFromFile([1]);The LoadFromFile method requires the file path as a string to load the asset bundle.
Complete the code to load an asset named "player" from the asset bundle.
GameObject player = bundle.[1]<GameObject>("player");
GetAsset which does not exist.LoadFromFile which loads bundles, not assets.The LoadAsset method loads an asset by name and type from the bundle.
Fix the error in unloading the asset bundle but keep loaded assets usable.
bundle.[1](false);Dispose which is not a method on AssetBundle.Unload(true) which unloads assets too.The Unload(false) method unloads the bundle but keeps loaded assets in memory.
Fill both blanks to create a dictionary of asset names and their sizes from an asset bundle.
Dictionary<string, long> assetSizes = new Dictionary<string, long>() {
{ [1], bundle.GetAssetSize([2]) }
};The dictionary key is the asset name string, and the value is the size from GetAssetSize using the same asset name.
Fill all three blanks to load an asset bundle asynchronously and get an asset named "tree".
var request = AssetBundle.LoadFromFileAsync([1]); request.completed += (asyncOp) => { var bundle = request.[2]; GameObject tree = bundle.[3]<GameObject>("tree"); };
assetBundle.LoadFromFile instead of LoadFromFileAsync.The async load needs the file path string, then access the loaded bundle via assetBundle, then load the asset with LoadAsset.