Beispiel #1
0
        private void CookBundle(string bundleName)
        {
            string bundlePath        = The.Workspace.GetBundlePath(Target.Platform, bundleName);
            bool   wasBundleModified = false;

            using (var bundle = CreateBundle(bundleName)) {
                AssetBundle.SetCurrent(bundle, false);
                (AssetBundle.Current as PackedAssetBundle).OnModifying += () => {
                    if (!wasBundleModified)
                    {
                        wasBundleModified = true;
                        string backupFilePath;
                        TryMakeBackup(bundlePath, out backupFilePath);
                        bundleBackupFiles.Add(backupFilePath);
                    }
                };
                CookBundleHelper(bundleName);
                // Open the bundle again in order to make some plugin post-processing (e.g. generate code from scene assets)
                using (new DirectoryChanger(The.Workspace.AssetsDirectory)) {
                    PluginLoader.AfterAssetsCooked(bundleName);
                }
            }
            if (wasBundleModified)
            {
                PackedAssetBundle.RefreshBundleCheckSum(bundlePath);
            }
        }
Beispiel #2
0
        private static void CookBundle(string bundleName)
        {
            string bundlePath = The.Workspace.GetBundlePath(bundleName);
            string backupFilePath;

            TryMakeBackup(bundlePath, out backupFilePath);
            bundleBackupFiles.Add(backupFilePath);

            using (AssetBundle.Current = CreateBundle(bundleName)) {
                CookBundleHelper(bundleName);
            }
            // Open the bundle again in order to make some plugin post-processing (e.g. generate code from scene assets)
            using (AssetBundle.Current = CreateBundle(bundleName)) {
                using (new DirectoryChanger(The.Workspace.AssetsDirectory)) {
                    PluginLoader.AfterAssetsCooked(bundleName);
                }
            }
            if (Platform != TargetPlatform.Unity)
            {
                PackedAssetBundle.RefreshBundleCheckSum(bundlePath);
            }
        }