UE5 非uasset资产Chunk/Pak 划分踩坑笔记

前言

引擎版本 UE 5.32源码
需求:打包时将非uasset资产(如Lua脚本)单独打入指定chunk包

遇到过的问题:

  • PakFileRules文件被排除
  • 设置了指定的chunkId但无效

流程

修改DefaultGame.ini,添加允许的配置文件目录

在这里插入图片描述

对AutomationTool\AutomationUtils\DeploymentContext.cs进行修改

将pakfilerules.ini注释掉,否则所有pakfilerules文件会被排除

对Scripts/CopyBuildToStagingDirectory.Automation.cs 进行修改

private struct PakFileRules
{
   
	// Name of config section
	public string Name;

	// Combined filter from all +Files= entries
	public FileFilter Filter;

	// An alternative and efficient way to match files
	public HashSet<string> ExactFileMatches = new();

	// To use exact file match or file filter
	public bool bUseExactFilePathMatch = false;

	// Rather to exclude entirely from paks
	public bool bExcludeFromPaks = false;

	// Rather to allow overriding the chunk manifest, if false will only modify loose files
	public bool bOverrideChunkManifest = false;

	// Whether pak file rule is disabled
	public bool bDisabled = false;

	// List of pak files to use instead of manifest
	public List<string> OverridePaks = new();

	// Whether this rule is defined for content-on-demand
	public bool bOnDemand = false;

	public bool bStageLoose = false;

	// Encryption key
	public string EncryptionKeyGuid = "";

	public PakFileRules()
	{
   
		Name = "";
		Filter = new FileFilter();
	}

	public static bool IsMatch(PakFileRules PakRules, KeyValuePair<string, string> StagingFile)
	{
   
		bool bMatched = !PakRules.bDisabled &&
			((!PakRules.bUseExactFilePathMatch && PakRules.Filter != null && PakRules.Filter.Matches(StagingFile.Key)) ||
			(PakRules.bUseExactFilePathMatch && PakRules.ExactFileMatches != null && PakRules.ExactFileMatches.Contains(StagingFile.Value)));
		
		return bMatched;
	}
};

/// <summary>
/// Reads Default/BasePakFileRules.ini and returns all PakFileRules objects that apply for this deployment
/// </summary>
/// <param name="Params"></param>
/// <param name="SC"></param>
private static List<PakFileRules
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值