Example #1
0
        static void BuildAssetBundles()
        {
            AssetBundleBuildConfig config = LoadAssetAtPath <AssetBundleBuildConfig>(configPath);

            if (config == null)
            {
                return;
            }

#if UNITY_5
            AssetBundleBuilder builder = new AssetBundleBuilder5x(new AssetBundlePathResolver());
#else
            AssetBundleBuilder builder = new AssetBundleBuilder4x(new AssetBundlePathResolver());
#endif
            if (config.bundleInfoFileFormt == AssetBundleBuildConfig.Format.Binary)
            {
                builder.SetDataWriter(new AssetBundleDataWriterBinary());
            }
            else
            {
                builder.SetDataWriter(new AssetBundleDataWriterText());
            }

            builder.Begin();
            builder.AddTargets(config);
            builder.Export(_buildTarget);
            builder.End();
        }
Example #2
0
        private void OnGUI()
        {
            if (_config == null)
            {
                _config = LoadAssetAtPath <AssetBundleBuildConfig>(configPath);
                if (_config == null)
                {
                    _config = new AssetBundleBuildConfig();
                }
            }

            if (_expandedCache == null)
            {
                _expandedCache = new ExpandedCache();
            }

            Draw();
        }
 public void AddTargets(AssetBundleBuildConfig config)
 {
     _config = config;
     _config.allDependNodes.ForEach(o => AddTargets(o));
     _dependNodes.ForEach(n => n.targets.ForEach(o => o.Analyze(ref _dependNodes)));
 }