// 将指定资源放入合适的分包中, 产生变化时返回 true // buildPlatform: 当前正在打包的平台 private bool AdjustBundleSlice(BundleBuilderData data, BundleBuilderData.BundleInfo bundleInfo, string bundleName, PackedObject packedObject) { var assetPath = AssetDatabase.GetAssetPath(packedObject.asset); var guid = AssetDatabase.AssetPathToGUID(assetPath); var streamingAssets = data.IsStreamingAssets(guid, bundleInfo); var slicePlatform = packedObject.platform; for (var i = 0; i < this.slices.Count; i++) { var oldSlice = this.slices[i]; if (oldSlice.AddHistory(guid, streamingAssets, slicePlatform)) { return(false); } } var lastSlice = GetLastSlice(streamingAssets, slicePlatform); if (lastSlice == null || !lastSlice.AddNew(guid)) { var sliceName = GetBundleSliceName(bundleName).ToLower(); var newSlice = new BundleSlice(sliceName, sliceObjects, streamingAssets, slicePlatform); this.slices.Add(newSlice); newSlice.AddNew(guid); } return(true); }