Esempio n. 1
0
        private void BuildAssetBundle(ItemFile file)
        {
            string path = string.Format("{0}/{1}", AssetBundlePath, file.folder);

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

            List <AssetBundleBuild> builds = new List <AssetBundleBuild>();

            AssetBundleBuild build = new AssetBundleBuild()
            {
                assetBundleName = Path.GetFileNameWithoutExtension(file.name),
                assetNames      = new string[] { file.path }
            };

            builds.Add(build);

            BuildPipeline.BuildAssetBundles(path, builds.ToArray(), BuildAssetBundleOptions.None, BuildTarget.Android);
        }
Esempio n. 2
0
        protected override void Init()
        {
            list = Finder.LoadFiles(Application.dataPath, "*.prefab");

            _list = new string[list.Count];

            for (int i = 0; i < list.Count; i++)
            {
                _list[i] = list[i].name;
            }

            indexPrefab.action = (index) =>
            {
                file = list[index];

                dependencies.Clear();

                if (string.IsNullOrEmpty(file.asset))
                {
                    prefab = null;
                }
                else
                {
                    prefab = AssetDatabase.LoadAssetAtPath <GameObject>(file.asset);

                    string[] _dependencies = AssetDatabase.GetDependencies(file.asset);

                    int count = _dependencies.Length;

                    for (int i = 0; i < count; i++)
                    {
                        dependencies.Add(AssetDatabase.LoadAssetAtPath <Object>(_dependencies[i]));
                    }
                }
            };
        }