示例#1
0
    public void Build(string dirPath, string atlasName)
    {
        TCommon.DeleteOutPutDir(TCommon._atlas);
        BuildTool.ClearAB();
        string prefabPath = $"{inAtlasPath}/{atlasName}/{atlasName}.prefab";

        prefabPath = TCommon.RemovePathPrefix(prefabPath);
        string pngPath = $"{inAtlasPath}/{atlasName}/{atlasName}.png";

        pngPath = TCommon.RemovePathPrefix(pngPath);
        Debug.Log(TCommon.RemovePathPrefix(prefabPath));
        AssetImporter importerPrefab = AssetImporter.GetAtPath(prefabPath);

        importerPrefab.assetBundleName    = atlasName;
        importerPrefab.assetBundleVariant = TCommon.ABSUFFIX;
        AssetImporter importerPng = AssetImporter.GetAtPath(pngPath);

        importerPng.assetBundleName    = atlasName;
        importerPng.assetBundleVariant = TCommon.ABSUFFIX;
        BuildTool.BuildBundle(outAtlasPath);
        BuildTool.ClearAB();
        BuildTool.DeleteManifest();
        AssetDatabase.Refresh();
    }