private static void CreateVirtualBundleData(ResourceManagerRuntimeData runtimeData)
        {
            var virtualBundleData = new VirtualAssetBundleRuntimeData(1000 * 1024, 200 * 1024); //1Mbs local speed, 200kbs remote speed
            var bundledAssets     = new Dictionary <string, List <string> >();

            foreach (var loc in runtimeData.locationData)
            {
                if (loc.provider == typeof(BundledAssetProvider).FullName)
                {
                    if (loc.dependencies == null || loc.dependencies.Length == 0)
                    {
                        continue;
                    }
                    //create virtual bundle data
                    foreach (var dep in loc.dependencies)
                    {
                        List <string> assetsInBundle = null;
                        if (!bundledAssets.TryGetValue(dep, out assetsInBundle))
                        {
                            bundledAssets.Add(dep, assetsInBundle = new List <string>());
                        }
                        assetsInBundle.Add(loc.id);
                    }
                }
            }

            foreach (var bd in bundledAssets)
            {
                var bundleLocData = runtimeData.locationData.Find(a => a.key == bd.Key);
                var size          = bd.Value.Count * 1024 * 1024; //for now estimate 1MB per entry
                virtualBundleData.simulatedAssetBundles.Add(new VirtualAssetBundle(bundleLocData.id, bundleLocData.provider == typeof(LocalAssetBundleProvider).FullName, size, bd.Value));
            }

            virtualBundleData.Save();
        }
 /// <summary>
 /// Initialize the VirtualAssetBundleManager object
 /// </summary>
 /// <param name="virtualBundleData">Runtime data that contains the virtual bundles.</param>
 /// <param name="bundleNameConverter">Func used to expand variables in bundle names.</param>
 public void Initialize(VirtualAssetBundleRuntimeData virtualBundleData, Func <string, string> bundleNameConverter)
 {
     Debug.Assert(virtualBundleData != null);
     m_LocalLoadSpeed  = virtualBundleData.LocalLoadSpeed;
     m_RemoteLoadSpeed = virtualBundleData.RemoteLoadSpeed;
     foreach (var b in virtualBundleData.AssetBundles)
     {
         m_AllBundles.Add(bundleNameConverter(b.Name), b);
     }
 }
        /// <summary>
        /// Loads runtime data and creates a VirtualAssetBundleManager object.
        /// </summary>
        /// <param name="bundleNameConverter">Func used to expand variables in bundle names.</param>
        /// <returns>The created VirtualAssetBundleManager.</returns>
        public static VirtualAssetBundleManager CreateManager(Func <string, string> bundleNameConverter)
        {
            var virtualBundleData = VirtualAssetBundleRuntimeData.Load();

            if (virtualBundleData == null)
            {
                return(null);
            }

            var mgr = new GameObject("VirtualAssetBundleManager", typeof(VirtualAssetBundleManager)).GetComponent <VirtualAssetBundleManager>();

            mgr.Initialize(virtualBundleData, bundleNameConverter);
            return(mgr);
        }