Ejemplo n.º 1
0
 static public AssetBundleLoadManifestOperation Initialize()
 {
     return(Initialize(Utility.GetPlatformName()));
 }
Ejemplo n.º 2
0
 public static void SetSourceAssetBundleURL(string absolutePath)
 {
     BaseDownloadingURL = absolutePath + Utility.GetPlatformName() + "/";
 }
Ejemplo n.º 3
0
        public static void BuildAssetBundles()
        {
            // Choose the output path according to the build target.
            string outputPath = Path.Combine(Application.streamingAssetsPath, Path.Combine(Utility.AssetBundlesOutputPath, Utility.GetPlatformName()));

            if (!Directory.Exists(outputPath))
            {
                Directory.CreateDirectory(outputPath);
            }

            //@TODO: use append hash... (Make sure pipeline works correctly with it.)
            BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
        }
Ejemplo n.º 4
0
        static string GetAssetBundleManifestFilePath()
        {
            var relativeAssetBundlesOutputPathForPlatform = Path.Combine(Utility.AssetBundlesOutputPath, Utility.GetPlatformName());

            return(Path.Combine(relativeAssetBundlesOutputPathForPlatform, Utility.GetPlatformName()) + ".manifest");
        }
Ejemplo n.º 5
0
        public static void BuildAssetBundles()
        {
            // Choose the output path according to the build target.
            string outputPath = Path.Combine(Utility.AssetBundlesOutputPath, Utility.GetPlatformName());

            if (!Directory.Exists(outputPath))
            {
                Directory.CreateDirectory(outputPath);
            }
            string[] str = AssetDatabase.GetAllAssetBundleNames();
            foreach (string item in str)
            {
                Debug.Log("Asset Name=" + item + "");
            }

            AssetBundleBuild[] buildMap = new AssetBundleBuild[3];

//			buildMap[0].assetBundleName = "universal";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("universal");


            buildMap[0].assetBundleName = "nearest_stars";
            buildMap[0].assetNames      = AssetDatabase.GetAssetPathsFromAssetBundle("nearest_stars");
            buildMap[1].assetBundleName = "universal";
            buildMap[1].assetNames      = AssetDatabase.GetAssetPathsFromAssetBundle("universal");

//            buildMap[0].assetBundleName = "q10k_01";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("q10k_01");


//			buildMap[0].assetBundleName = "solar_system_book";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("solar_system_book");
//			buildMap[1].assetBundleName = "universal";
//			buildMap[1].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("universal");

//			buildMap[0].assetBundleName = "solar_system_book";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("solar_system_book");

//			buildMap[0].assetBundleName = "weather_maker";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("weather_maker");

//			buildMap[0].assetBundleName = "fishingman";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("fishingman");
//			buildMap[1].assetBundleName = "weather_maker";
//			buildMap[1].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("weather_maker");


//			buildMap[0].assetBundleName = "littleredridinghood";
//			buildMap[0].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle("littleredridinghood");

            BuildPipeline.BuildAssetBundles(outputPath, buildMap, BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
            //AssetDatabase.
            //@TODO: use append hash... (Make sure pipeline works correctly with it.)
            //BuildPipeline.BuildAssetBundles (outputPath, BuildAssetBundleOptions.UncompressedAssetBundle, EditorUserBuildSettings.activeBuildTarget);

            string src = outputPath + "/" + EditorUserBuildSettings.activeBuildTarget.ToString();
            string des = outputPath + "/" + buildMap[0].assetBundleName + ".mf";

            if (File.Exists(des))
            {
                File.Delete(des);
            }

            Debug.Log("move file " + src + " ====> " + des);
            System.IO.File.Move(src, des);
        }
        /// <param name="decorated">CommandHandler to use when the bundle is not available in StreamingAssets</param>
        /// <param name="strategy">
        ///     Strategy to use.  Defaults to having remote bundle override StreamingAssets bundle if the hashes
        ///     are different
        /// </param>
        public StreamingAssetsBundleDownloadDecorator(ICommandHandler <AssetBundleDownloadCommand> decorated, AssetBundleManager.PrioritizationStrategy strategy)
        {
            this.decorated  = decorated;
            currentStrategy = strategy;
            currentPlatform = Utility.GetPlatformName();

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                coroutineHandler = EditorCoroutine.Start;
            }
            else
#endif
            coroutineHandler = AssetBundleDownloaderMonobehaviour.Instance.HandleCoroutine;

            fullBundlePath = string.Format("{0}/{1}", Application.streamingAssetsPath, Utility.GetPlatformName());
            var manifestBundle = AssetBundle.LoadFromFile(string.Format("{0}/{1}", fullBundlePath, currentPlatform));

            if (manifestBundle == null)
            {
                Debug.LogWarning("Unable to retrieve manifest file from StreamingAssets, disabling StreamingAssetsBundleDownloadDecorator.");
            }
            else
            {
                manifest = manifestBundle.LoadAsset <AssetBundleManifest>("assetbundlemanifest");
                manifestBundle.Unload(false);
            }
        }
 public AssetBundleManager()
 {
     platformName = Utility.GetPlatformName();
 }
Ejemplo n.º 8
0
		public static void Initialize()
		{
			if (!AssetBundleManager.m_Instance)
			{
				AssetBundleManager.SetSourceAssetBundleURL(Path.GetFullPath(Application.dataPath).Replace("\\", "/") + "/AssetBundles/");
				AssetBundleManager assetBundleManager = new GameObject("AssetBundleManager").AddComponent<AssetBundleManager>();
				UnityEngine.Object.DontDestroyOnLoad(assetBundleManager);
				AssetBundleManager.m_Instance = assetBundleManager;
				AssetBundleLoadManifestOperation assetBundleLoadManifestOperation = AssetBundleManager.Initialize(Utility.GetPlatformName());
				if (assetBundleLoadManifestOperation != null)
				{
					AssetBundleManager.m_Instance.StartCoroutine(assetBundleLoadManifestOperation);
				}
			}
		}
 public static void SetSourceAssetBundleDirectory()
 {
     BaseDownloadingURL = GetStreamingAssetsPath() + "/" + Utility.GetPlatformName() + "/";
 }