コード例 #1
0
        static void BuildAssetBundles()
        {
            AssetBundleBuildConfig config = LoadAssetAtPath <AssetBundleBuildConfig>(savePath);

            if (config == null)
            {
                return;
            }

#if UNITY_5
            ABBuilder builder = new AssetBundleBuilder5x(new AssetBundlePathResolver());
#else
            ABBuilder builder = new AssetBundleBuilder4x(new AssetBundlePathResolver());
#endif
            builder.SetDataWriter(config.depInfoFileFormat == AssetBundleBuildConfig.Format.Text ? new AssetBundleDataWriter() : new AssetBundleDataBinaryWriter());

            builder.Begin();

            for (int i = 0; i < config.filters.Count; i++)
            {
                AssetBundleFilter f = config.filters[i];
                if (f.valid)
                {
                    builder.AddRootTargets(new DirectoryInfo(f.path), new string[] { f.filter });
                }
            }

            builder.Export();
            builder.End();
        }
コード例 #2
0
 void InitConfig()
 {
     _config = LoadAssetAtPath <AssetBundleBuildConfig>(savePath);
     if (_config == null)
     {
         _config = new AssetBundleBuildConfig();
     }
 }