Exemplo n.º 1
0
        /// <summary>
        ///   设置AssetBundleName
        /// </summary>
        public static void ClearAssetBundleName(string full_name)
        {
            full_name = EditorCommon.AbsoluteToRelativePath(full_name);
            AssetImporter importer = AssetImporter.GetAtPath(full_name);

            if (importer != null)
            {
                importer.assetBundleName = "";
                importer.SaveAndReimport();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///   设置AssetBundleName
        /// </summary>
        public static void SetAssetBundleName(string full_name)
        {
            full_name = EditorCommon.AbsoluteToRelativePath(full_name);
            AssetImporter importer = AssetImporter.GetAtPath(full_name);

            if (importer != null)
            {
                string str = EditorCommon.ConvertToAssetBundleName(full_name.ToLower());
                importer.assetBundleName    = str;
                importer.assetBundleVariant = "";
                importer.SaveAndReimport();
            }
        }
        /// <summary>
        ///   添加选中的资源数据至包中
        /// </summary>
        public void AddSelectionAsset(ResourcesPackagesData.Package pack)
        {
            if (pack == null)
            {
                return;
            }

            foreach (var id in Selection.instanceIDs)
            {
                string str       = AssetDatabase.GetAssetPath(id);
                string full_name = EditorCommon.RelativeToAbsolutePath(str);
                if (System.IO.File.Exists(full_name))
                {
                    if (!EditorCommon.IsIgnoreFile(str))
                    {
                        if (!pack.AssetList.Contains(str))
                        {
                            str = str.ToLower();
                            pack.AssetList.Add(str);
                        }
                    }
                }
                else if (System.IO.Directory.Exists(str))
                {
                    System.IO.DirectoryInfo dic = new System.IO.DirectoryInfo(str);
                    foreach (var file in dic.GetFiles("*", System.IO.SearchOption.AllDirectories))
                    {
                        string local = EditorCommon.AbsoluteToRelativePath(file.FullName);
                        if (!string.IsNullOrEmpty(local) && !EditorCommon.IsIgnoreFile(local))
                        {
                            if (!pack.AssetList.Contains(local))
                            {
                                local = local.ToLower();
                                pack.AssetList.Add(local);
                            }
                        }
                    }
                }
            }
        }