Beispiel #1
0
    private static void MakeAnimatorControllerAssetBundleData(string patch)
    {
        AssetImporter assetImporter = AssetImporter.GetAtPath(patch);

        if (!assetImporter)
        {
            return;
        }

        string asPatch = assetImporter.assetPath;

        //不是来自于prefab的,再commonartist目录下才可以生成AB名
        bool bFromPrefab = assetImporter.userData.Contains(FromReferencebKey);

        assetImporter.userData = assetImporter.userData.Replace(FromReferencebKey, "");

        if (bFromPrefab)
        {
            SaveAssetBundleUserData(assetImporter, assetImporter.userData);
            return;
        }

        if (!IsCommonArtistAssets(asPatch))
        {
            return;
        }

        AssetBundleManagerEditor.AssetBundleEditorInfo info = BuildAnimatorControllerAssetBundleInfo(assetImporter, string.Empty);
        if (info == null)
        {
            return;
        }
        SaveAssetBundleData(assetImporter, info);
    }
Beispiel #2
0
    public static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSchemeAssetBundleInfo(string patch)
    {
        AssetBundleManagerEditor.AssetBundleEditorInfo info = null;
        AssetImporter assetImporter = AssetImporter.GetAtPath(patch);

        if (!assetImporter)
        {
            return(info);
        }

        string asPatch = assetImporter.assetPath;

        //不是在这个路径下的,不是场景文件,不处理
        if (!isSchemeAssets(asPatch))
        {
            return(info);
        }

        //移除头部
        asPatch = asPatch.Replace(SchemePatch, "");

        string[] strs = asPatch.Split('/');

        //没有放到其他文件夹下,则使用默认的包
        if (strs.Length <= 1)
        {
            asPatch = "Default";
        }
        else
        {
            //移除名字
            asPatch = asPatch.Replace(strs[strs.Length - 1], "");

            //再移除最后的斜杠
            asPatch = asPatch.Remove(asPatch.Length - 1);
        }

        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);
        string guid      = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (guid.Equals(string.Empty))
        {
            return(info);
        }

        //最后就是包名
        string abName  = AssetBundleManager.SchemeVariant + "/" + asPatch;
        string variant = AssetBundleManager.SchemeVariant;

        SaveAssetBundleData(assetImporter, abName, variant);

        info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = abName;
        info.AssetBundleVarian = variant;
        info.guid      = guid;
        info.assetName = assetName;

        DispatchScheme(patch);
        return(info);
    }
Beispiel #3
0
    public static AssetBundleManagerEditor.AssetBundleEditorInfo MakePrefabAssetBundleInfo(string patch)
    {
        AssetBundleManagerEditor.AssetBundleEditorInfo info = null;
        string lowerPatch = patch;

        if (!IsPrefabAssets(lowerPatch))
        {
            return(info);
        }

        AssetImporter assetImporter = AssetImporter.GetAtPath(patch);

        if (!assetImporter)
        {
            return(info);
        }

        string asPatch = assetImporter.assetPath;

        //移除头部
        asPatch = asPatch.Replace(PrefabPatch, "");
        asPatch = asPatch.Replace(ArtitsPatch, "");

        string[] strs = asPatch.Split('/');

        //没有放到其他文件夹下,则使用默认的包
        if (strs.Length <= 1)
        {
            asPatch = "Default";
        }
        else
        {
            //移除名字
            asPatch = asPatch.Replace(strs[strs.Length - 1], "");

            //再移除最后的斜杠
            asPatch = asPatch.Remove(asPatch.Length - 1);
        }

        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);
        string guid      = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (guid.Equals(string.Empty))
        {
            return(info);
        }

        string abName  = "gameobject/" + asPatch + "/" + assetName;
        string variant = AssetBundleManager.PrefabVariant;

        SaveAssetBundleData(assetImporter, abName, variant);

        info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = abName;
        info.AssetBundleVarian = variant;
        info.guid      = guid;
        info.assetName = assetName;
        return(info);
    }
Beispiel #4
0
    /// <summary>
    /// 保存AssetBundle,版本升级后,再onpostallassets阶段,ab名不会写入到meta文件了,需要手动写入
    /// </summary>
    /// <param name="assetImporter"></param>
    private static void SaveAssetBundleData(AssetImporter assetImporter, AssetBundleManagerEditor.AssetBundleEditorInfo info)
    {
        if (!assetImporter || null == info)
        {
            return;
        }

        SaveAssetBundleData(assetImporter, info.AssetBundleName, info.AssetBundleVarian);
    }
    public static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSoundAssetBundleInfoFromReference(string patch)
    {
        AssetBundleManagerEditor.AssetBundleEditorInfo info = AssetBundleManagerEditor.GetAssetBundleEditorInfo(patch);

        if (null != info)
        {
            return(info);
        }

        info = MakeSoundAssetBundleData(patch);
        return(info);
    }
Beispiel #6
0
 private static void PushPrefabAssetImport(AssetImporter assetImporter, AssetBundleManagerEditor.AssetBundleEditorInfo info)
 {
     if (!assetImporter || info == null)
     {
         return;
     }
     if (allGeneratePrefabAssetBundleInfoTable.ContainsKey(assetImporter))
     {
         allGeneratePrefabAssetBundleInfoTable[assetImporter] = info;
     }
     else
     {
         allGeneratePrefabAssetBundleInfoTable.Add(assetImporter, info);
     }
 }
Beispiel #7
0
    static void MakeMaterialAssetBundle(string patch)
    {
        AssetImporter assetImporter = AssetImporter.GetAtPath(patch);

        if (!assetImporter)
        {
            return;
        }

        string asPatch = patch;

        if (!IsMaterialAsset(asPatch))
        {
            return;
        }

        /*
         * 只有Artist目录下的Mat才会被打包
         * 一般情况下,FBX的包是通过预制体来生成包的,但是也有一种例外
         * 就是在通用资源(Artist/CommonArtist)下的fbx,这些是必须要打包的。
         */

        //不是来自于prefab的,再commonartist目录下才可以生成AB名
        bool bFromPrefab = assetImporter.userData.Contains(FromReferencebKey);

        assetImporter.userData = assetImporter.userData.Replace(FromReferencebKey, "");
        if (bFromPrefab)
        {
            SaveAssetBundleUserData(assetImporter, assetImporter.userData);
            return;
        }

        if (!IsCommonArtistAssets(asPatch))
        {
            return;
        }

        AssetBundleManagerEditor.AssetBundleEditorInfo info = BuildMaterialAssetBundleInfo(assetImporter, string.Empty);
        if (info == null)
        {
            return;
        }
        SaveAssetBundleData(assetImporter, info);
    }
    private static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSceneAssetBundleInfo(string patch)
    {
        AssetBundleManagerEditor.AssetBundleEditorInfo info = null;
        AssetImporter assetImporter = AssetImporter.GetAtPath(patch);

        if (!assetImporter)
        {
            return(info);
        }

        string asPatch = assetImporter.assetPath;

        //不是在这个路径下的,不是场景文件,不处理
        if (!isSceneAssets(asPatch))
        {
            return(info);
        }

        //场景文件是一个文件一个包,所以去掉头,然后去调后缀名就是包了
        //移除头部
        asPatch = asPatch.Replace(scenePatch, "");
        //就去掉后缀名
        asPatch = asPatch.Replace(".unity", "");

        string abName  = "Scene/" + asPatch;
        string variant = AssetBundleManager.sceneVariant;

        string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (guid.Equals(string.Empty))
        {
            return(info);
        }
        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);

        SaveAssetBundleData(assetImporter, abName, variant);

        info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = abName;
        info.AssetBundleVarian = variant;
        info.guid      = guid;
        info.assetName = assetName;
        return(info);
    }
    private static void MakeTextureAssetBundle(string path)
    {
        AssetImporter assetImporter = AssetImporter.GetAtPath(path);

        if (!assetImporter)
        {
            return;
        }

        string asPatch = assetImporter.assetPath;

        //不是在这个路径下的,不处理
        if (!IsTextureAsset(asPatch))
        {
            return;
        }
        bool bFromPrefab = assetImporter.userData.Contains(FromReferencebKey);

        assetImporter.userData = assetImporter.userData.Replace(FromReferencebKey, "");

        if (bFromPrefab)
        {
            SaveAssetBundleUserData(assetImporter, assetImporter.userData);
            return;
        }

        /*
         * 不是来自于Prefab的,自动生成ab包的,只有UI动态目录,通用资源目录
         * 不是这两个目录的,只能通过prefab来生成ab包
         */
        if (!IsUIDynamicAssets(asPatch) && !IsCommonArtistAssets(asPatch))
        {
            return;
        }


        AssetBundleManagerEditor.AssetBundleEditorInfo info = BuildTextureAssetBundleInfo(assetImporter, string.Empty);
        if (info == null)
        {
            return;
        }
        SaveAssetBundleData(assetImporter, info);
    }
Beispiel #10
0
    /// <summary>
    /// 构建ab,原因是被需要的东西引用了
    /// </summary>
    /// <param name="path"></param>
    /// <param name="referenceAssetbundleName">参考名,如果为空,则会使用默认的生成方式</param>
    /// <param name="referenceVariant">参考名,如果为空,则会使用默认的生成方式<</param>
    /// <returns></returns>
    public static ResConfigData MakeMaterialAssetBundleFromReference(string path, string referenceAssetbundleName)
    {
        ResConfigData conf = null;

        if (path.Equals(string.Empty))
        {
            return(conf);
        }

        AssetBundleManagerEditor.AssetBundleEditorInfo info = null;
        AssetImporter assetImporter = AssetImporter.GetAtPath(path);

        if (!assetImporter)
        {
            return(conf);
        }
        if (!IsCanGeneratePrefabUnionRes(path))
        {
            referenceAssetbundleName = string.Empty;
        }
        //然后刷一下名字
        info = BuildMaterialAssetBundleInfo(assetImporter, referenceAssetbundleName);
        //如果还是取不到,就说明不是贴图了。
        if (info == null)
        {
            return(conf);
        }
        if (!assetImporter.userData.Contains(FromReferencebKey))
        {
            assetImporter.userData += FromReferencebKey;
        }
        assetImporter.userData += FromReferencebKey;
        //没有在打包的时候,不需要写入ab包,因为编辑器不走ab包
        if (AssetBundleManagerEditor.isBuildingPackage)
        {
            PushPrefabAssetImport(assetImporter, info);
            //SaveAssetBundleData(assetImporter, info);
        }
        return(info.ConvertToResConfigData());
    }
Beispiel #11
0
    /// <summary>
    /// 导入单个预制体,会刷新资源数据库,生成新的配置资源,并且降单个预制体配置导入到
    /// 配置表
    /// </summary>
    /// <param name="patch"></param>
    public static void ImportSinglePrefab(string patch, bool isImportingTime)
    {
        string lowerPatch = patch;

        if (!IsPrefabAssets(lowerPatch))
        {
            return;
        }


        string        skinPatch       = "Prefabs/Skin";
        string        skinHeroPatch   = "Prefabs/Skin/Hero";
        List <string> dependeciesList = new List <string>(AssetDatabase.GetDependencies(new string[] { patch }));

        if (lowerPatch.Contains(skinPatch))
        {
            if (dependeciesList.Count > 90)
            {
                if (EditorRunTypeWindow.currentEditorRunType == EditorRunType.DevelopMachine || EditorRunTypeWindow.currentEditorRunType == EditorRunType.ResourcesCleanUpMachine)
                {
                    Debug.LogError(patch + ",引用超过90,当前引用:" + dependeciesList.Count + ",请检查是否有不正确的引用");
                    return;
                }
            }
        }


        if (EditorRunTypeWindow.currentEditorRunType == EditorRunType.DevelopMachine || EditorRunTypeWindow.currentEditorRunType == EditorRunType.ResourcesCleanUpMachine)
        {
            //等待下次导入
            if (IsReferenceUnityDefaultAssets(patch))
            {
                Debug.LogError(patch + "引用了Unity内置资源(如系统自带的UI资源[UIMask、UISprite等],材质,Cube等),请移除,如需引用内置资源请引用:" + extractUnityDefaultPathRoot + "下的资源");
                //ClearAssetBundleData(AssetImporter.GetAtPath(patch));
                //return;
            }
        }

        //只在非导入的时候检查资源,因为导入的时候有可能其他资源没有导进来。
        if (!isImportingTime || EditorRunTypeWindow.currentEditorRunType == EditorRunType.DevelopMachine)
        {
            if (!CheckPrefabAssets(patch, lowerPatch.Contains(skinPatch), lowerPatch.Contains(skinHeroPatch)))
            {
                return;
            }
        }

        AssetBundleManagerEditor.AssetBundleEditorInfo info = null;
        //if (EditorRunTypeWindow.currentEditorRunType == EditorRunType.DevelopMachine || EditorRunTypeWindow.currentEditorRunType == EditorRunType.ResourcesCleanUpMachine) //开发机去构建这个
        {
            info = MakePrefabAssetBundleInfo(patch);
            if (info == null)
            {
                Debug.LogError("预制体取得AssetBundleEditorInfo失败,路径:" + patch);
                return;
            }
        }
        //else if (EditorRunTypeWindow.currentEditorRunType == EditorRunType.PackingMachine)//而打包机,只需要去取
        //{
        //    info = AssetBundleManagerEditor.GetAssetBundleEditorInfo(patch);
        //    if(info == null)
        //    {
        //        Debug.LogWarning("读取资源包配置失败:" + patch);
        //        return;
        //    }
        //}


        List <string> texConfig        = new List <string>();
        List <string> FBXConfig        = new List <string>();
        List <string> ClipConfig       = new List <string>();
        List <string> ControllerConfig = new List <string>();
        List <string> ShaderConfig     = new List <string>();
        List <string> MaterialConfig   = new List <string>();

        //引用的资源,无非就几种:代码,贴图,材质球,动画控制器,动画Mask,动画clip,fbx
        //我们只将贴图、fbx、动画控制器、动画clip打包,其他的直接整合到prefab的包里面
        foreach (string s in dependeciesList)
        {
            if (IsCanImportDependicens_FBX(patch, s, isImportingTime))
            {
                string        referenceAbName = info.AssetBundleName.Replace("gameobject", "model") + AssetBundleManager.PrefabUnionResKey;
                ResConfigData cof             = MakeFBXAssetBundleFromReference(s, referenceAbName);
                if (cof == null)
                {
                    Debug.LogError("取得资源配置失败:" + s);
                    continue;
                }
                AssetBundleManager.PushDependenicesRes(cof);
                FBXConfig.Add(cof.AssetGUID);
            }
            else if (IsCanImportDependicens_Texture(patch, s, isImportingTime))
            {
                string        referenceAbName = info.AssetBundleName.Replace("gameobject", "texture") + AssetBundleManager.PrefabUnionResKey;
                ResConfigData cof             = MakeTextureAssetBundleFromReference(s, referenceAbName);
                if (cof == null)
                {
                    Debug.LogError("取得资源配置失败:" + s + ",请及时修复,否则会导致预制体加载失败");
                    continue;
                }
                AssetBundleManager.PushDependenicesRes(cof);
                texConfig.Add(cof.AssetGUID);
            }
            else if (IsCanImportDependicens_AniController(patch, s, isImportingTime))
            {
                string        referenceAbName = info.AssetBundleName.Replace("gameobject", "animcontroller") + AssetBundleManager.PrefabUnionResKey;
                ResConfigData cof             = MakeAnimatorControllerAssetBundleFromReference(s, referenceAbName);
                if (cof == null)
                {
                    Debug.LogError("取得资源配置失败:" + s + ",请及时修复,否则会导致预制体加载失败");
                    continue;
                }
                AssetBundleManager.PushDependenicesRes(cof);
                ControllerConfig.Add(cof.AssetGUID);
            }
            else if (IsCanImportDependicens_AniClip(patch, s, isImportingTime))
            {
                string        referenceAbName = info.AssetBundleName.Replace("gameobject", "animclip") + AssetBundleManager.PrefabUnionResKey;
                ResConfigData cof             = MakeAnimatorClipAssetBundleFromReference(s, referenceAbName);
                if (cof == null)
                {
                    Debug.LogError("取得资源配置失败:" + s + ",请及时修复,否则会导致预制体加载失败");
                    continue;
                }
                AssetBundleManager.PushDependenicesRes(cof);
                ClipConfig.Add(cof.AssetGUID);
            }
            else if (IsCanImportDependicens_Material(patch, s, isImportingTime))
            {
                string        referenceAbName = info.AssetBundleName.Replace("gameobject", "material") + AssetBundleManager.PrefabUnionResKey;
                ResConfigData cof             = MakeMaterialAssetBundleFromReference(s, referenceAbName);
                if (cof == null)
                {
                    Debug.LogError("取得资源配置失败:" + s + ",请及时修复,否则会导致预制体加载失败");
                    continue;
                }
                AssetBundleManager.PushDependenicesRes(cof);
                MaterialConfig.Add(cof.AssetGUID);
            }
            else if (IsPrefabAssets(s) && !s.Equals(lowerPatch))
            {
                if (!s.Contains(AssetBundleManager.PrefabCommonPatch))
                {
                    Debug.LogError("不能引用预制体,如果要引用,请使用动态加载!" + lowerPatch + ",引用路径:" + s);
                    continue;
                }
            }
        }
        AssetBundleManager.PushPrefabConfig(info.ConvertToUnionResConfigData(),
                                            texConfig, FBXConfig,
                                            ClipConfig, ControllerConfig,
                                            ShaderConfig, MaterialConfig);
    }
    private static AssetBundleManagerEditor.AssetBundleEditorInfo MakeSoundAssetBundleData(string path)
    {
        AssetBundleManagerEditor.AssetBundleEditorInfo info = null;
        AssetImporter importer = AssetImporter.GetAtPath(path);

        if (!importer)
        {
            return(info);
        }
        AudioImporter assetImporter = importer as AudioImporter;

        if (!assetImporter)
        {
            return(info);
        }

        string asPatch = assetImporter.assetPath;

        //不是在这个路径下的,不处理
        if (!isAudioAssets(asPatch))
        {
            return(info);
        }

        //移除头部
        asPatch = asPatch.Replace(soundAssetPatch, "");

        string[] strs = asPatch.Split('/');

        //没有放到其他文件夹下,则使用默认的音效包名
        if (strs.Length <= 1)
        {
            asPatch = "DefaultSound";
        }
        else
        {
            //移除名字
            asPatch = asPatch.Replace(strs[strs.Length - 1], "");

            //再移除最后的斜杠
            asPatch = asPatch.Remove(asPatch.Length - 1);
        }

        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);

        string guid = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (guid.Equals(string.Empty))
        {
            return(info);
        }

        string abName  = "Sound/" + asPatch;
        string variant = AssetBundleManager.soundVariant;

        SaveAssetBundleData(assetImporter, abName, variant);

        info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = abName;
        info.AssetBundleVarian = variant;
        info.guid      = guid;
        info.assetName = assetName;
        return(info);
    }
Beispiel #13
0
    private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildAnimatorControllerAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName)
    {
        string AbName    = string.Empty;
        string AbVirtant = string.Empty;

        if (!assetImporter)
        {
            return(null);
        }

        if (!CheckAssetDependices(assetImporter.assetPath))
        {
            return(null);
        }

        string asPatch = assetImporter.assetPath;

        if (!IsControllerAsset(asPatch))
        {
            return(null);
        }

        //区分一下是模型还是特效
        string patchHead = string.Empty;

        if (asPatch.Contains(ModelAnimatorControllerPatch))
        {
            patchHead = "model/";
        }

        //移除头部
        asPatch = asPatch.Replace(ModelAnimatorControllerPatch, "");
        asPatch = asPatch.Replace(ArtitsPatch, "");


        string[] strs = asPatch.Split('/');

        //没有放到其他文件夹下,则使用默认的包
        if (strs.Length <= 1)
        {
            asPatch = "Default";
        }
        else
        {
            //移除名字
            asPatch = asPatch.Replace(strs[strs.Length - 1], "");

            //再移除最后的斜杠
            asPatch = asPatch.Remove(asPatch.Length - 1);
        }
        AbName    = "animcontroller/" + patchHead + asPatch;
        AbVirtant = AssetBundleManager.AnimatorControllerVariant;

        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);
        string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty))
        {
            return(null);
        }
        if (!referenceAssetbundleName.Equals(string.Empty))
        {
            AbName = referenceAssetbundleName;
        }
        AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = AbName;
        info.AssetBundleVarian = AbVirtant;
        info.guid      = assetGUID;
        info.assetName = assetName;
        return(info);
    }
    private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildTextureAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName)
    {
        string AbName              = string.Empty;
        string AbVirtant           = string.Empty;
        string asPatch             = assetImporter.assetPath;
        bool   isSprite            = IsSpriteAssets(asPatch);
        bool   isHaveSpritePacking = false;

        if (isSprite)
        {
            TextureImporter tp = assetImporter as TextureImporter;
            isHaveSpritePacking = IsHaveSpritePacking(tp);

            if (isHaveSpritePacking)
            {
                BuildTextureAssetBundleName_SpritePacking(tp.spritePackingTag, out AbName, out AbVirtant, true);
            }
            else
            {
                BuildTextureAssetBundleName_Normal(asPatch, out AbName, out AbVirtant, true, referenceAssetbundleName);
            }
        }
        else
        {
            BuildTextureAssetBundleName_Normal(asPatch, out AbName, out AbVirtant, false, referenceAssetbundleName);
        }

        if (AbName.Equals(string.Empty) || AbVirtant.Equals(string.Empty))
        {
            return(null);
        }

        string assetName = Path.GetFileNameWithoutExtension(asPatch);
        string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(asPatch);

        if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty))
        {
            return(null);
        }
        AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = AbName;
        info.AssetBundleVarian = AbVirtant;
        info.guid      = assetGUID;
        info.assetName = assetName;
        info.Asset_X   = -1;
        info.Asset_Y   = -1;
        if (!isHaveSpritePacking)
        {
            int w, h;
            if (!GetTextureInfo(assetImporter, out w, out h))
            {
                Debug.LogWarning("贴图信息读取失败,请重新导入资源:" + assetImporter.assetPath);
                info.Asset_X = 2048;
                info.Asset_Y = 2048;
            }
            else
            {
                info.Asset_X = w;
                info.Asset_Y = h;
            }
        }
        else
        {
            //info.Asset_X = 3535;//特殊含义,表示这个贴图有图集,因为图集会分多个group,在加载之前是不知道属于哪一个group的
            //info.Asset_Y = 5353;

            info.Asset_X = 2048;
            info.Asset_Y = 2048;
        }
        return(info);
    }
Beispiel #15
0
    private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildMaterialAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName)
    {
        string AbName    = string.Empty;
        string AbVirtant = string.Empty;

        if (!assetImporter)
        {
            return(null);
        }

        if (!CheckAssetDependices(assetImporter.assetPath))
        {
            return(null);
        }

        string asPatch = assetImporter.assetPath;

        if (!IsMaterialAsset(asPatch))
        {
            return(null);
        }

        //移除头部
        asPatch = asPatch.Replace(ArtitsPatch, "");
        string[] strs = asPatch.Split('/');

        //没有放到其他文件夹下,则使用默认的包
        if (strs.Length <= 1)
        {
            asPatch = "Default";
        }
        else
        {
            //移除名字
            asPatch = asPatch.Replace(strs[strs.Length - 1], "");

            //再移除最后的斜杠
            asPatch = asPatch.Remove(asPatch.Length - 1);
        }


        //最后就是包名
        AbName    = "Material/" + asPatch;
        AbVirtant = AssetBundleManager.MatVariant;

        if (AbName.Equals(string.Empty) || AbVirtant.Equals(string.Empty))
        {
            return(null);
        }

        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);
        string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty))
        {
            return(null);
        }
        if (!referenceAssetbundleName.Equals(string.Empty))
        {
            AbName = referenceAssetbundleName;
        }
        AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = AbName;
        info.AssetBundleVarian = AbVirtant;
        info.guid      = assetGUID;
        info.assetName = assetName;
        return(info);
    }
    private static AssetBundleManagerEditor.AssetBundleEditorInfo BuildAnimatorClipAssetBundleInfo(AssetImporter assetImporter, string referenceAssetbundleName)
    {
        string AbName    = string.Empty;
        string AbVirtant = string.Empty;

        if (!assetImporter)
        {
            return(null);
        }

        string asPatch = assetImporter.assetPath;

        //移除头部
        asPatch = asPatch.Replace(ArtitsPatch, "");

        string[] strs = asPatch.Split('/');

        //没有放到其他文件夹下,则使用默认的包
        if (strs.Length <= 1)
        {
            asPatch = "Default";
        }
        else
        {
            //移除名字
            asPatch = asPatch.Replace(strs[strs.Length - 1], "");

            //再移除最后的斜杠
            asPatch = asPatch.Remove(asPatch.Length - 1);
        }


        //最后就是包名
        AbName    = "animclip/" + asPatch;
        AbVirtant = AssetBundleManager.AnimatorClipVariant;

        string assetName = Path.GetFileNameWithoutExtension(assetImporter.assetPath);
        string assetGUID = AssetBundleManagerEditor.GetAssetGUIDFromMeta(assetImporter.assetPath);

        if (assetName.Equals(string.Empty) || assetGUID.Equals(string.Empty))
        {
            return(null);
        }
        if (!referenceAssetbundleName.Equals(string.Empty))
        {
            AbName = referenceAssetbundleName;
        }
        AssetBundleManagerEditor.AssetBundleEditorInfo info = new AssetBundleManagerEditor.AssetBundleEditorInfo();
        info.AssetBundleName   = AbName;
        info.AssetBundleVarian = AbVirtant;
        info.guid      = assetGUID;
        info.assetName = assetName;


        AssetBundleManagerEditor.AssetFileInfo fileInfo = AssetBundleManagerEditor.GetFileInfo(AssetBundleManagerEditor.ConverRelativePatchToObslotePatch(assetImporter.assetPath));
        if (fileInfo != null)
        {
            info.Asset_X = fileInfo.fileLengthInMB;
            info.Asset_Y = fileInfo.fileLengthInMB;
        }
        return(info);
    }
 private static void OnImportLightingEffectSceheme(string path)
 {
     AssetBundleManagerEditor.AssetBundleEditorInfo da = AssetBundleManagerEditor.GetAssetBundleEditorInfo(path);
 }