2025-01-09 11:31:04 +08:00
using System ;
using System.IO ;
using System.Linq ;
using System.Collections ;
using System.Collections.Generic ;
using UnityEditor ;
namespace YooAsset.Editor
{
public class TaskGetBuildMap_RFBP : TaskGetBuildMap , IBuildTask
{
void IBuildTask . Run ( BuildContext context )
{
var buildParametersContext = context . GetContextObject < BuildParametersContext > ( ) ;
var buildMapContext = CreateBuildMap ( true , buildParametersContext . Parameters ) ;
context . SetContextObject ( buildMapContext ) ;
// 检测构建结果
CheckBuildMapContent ( buildMapContext ) ;
}
/// <summary>
/// 检测资源构建上下文
/// </summary>
private void CheckBuildMapContent ( BuildMapContext buildMapContext )
{
// 注意:原生文件资源包只能包含一个原生文件
foreach ( var bundleInfo in buildMapContext . Collection )
{
2025-02-28 16:11:01 +08:00
if ( bundleInfo . AllPackAssets . Count ! = 1 )
2025-01-09 11:31:04 +08:00
{
string message = BuildLogger . GetErrorMessage ( ErrorCode . NotSupportMultipleRawAsset , $"The bundle does not support multiple raw asset : {bundleInfo.BundleName}" ) ;
throw new Exception ( message ) ;
}
}
}
}
}