Description

The rules by which chunks are created are ambiguous and currently do not ensure that both PakFileRules and PrimaryAssetLabel settings are reflected. In this sample, depending on the PrimaryAssetLabel setting, the PakFileRules setting is not reflected in some cases and is reflected in some chunks.

In this sample example, we are trying to override chunks 1-8 in PakFileRules, and in the PrimaryAssetLabel, only chunk ID=0 is specified. In this case, the only chunk created by packaging is 0.

On the other hand, if you change chunk ID=5 in the PrimaryAssetLabel, chunks 0-3 and 5 will be created. There appears to be no consistency here. 

The following workaround code can be added to ensure that the PakFileRules settings are reflected. 

Workaround:
//UE4/Release-4.27/Engine/Source/Programs/AutomationTool/Scripts/CopyBuildToStagingDirectory.Automation.cs

private static void CreatePaksUsingChunkManifests(ProjectParams Params, DeploymentContext SC)
{
    // ...
				// Now run through the pak rules which may override things
				ApplyPakFileRules(PakRulesList, StagingFile, PakList, ChunkNameToDefinition, out bExcludeFromPaks);

#if true
				foreach (var chunk in ChunkNameToDefinition)
				{
					bool isExist = ChunkDefinitions.Exists(cd =>
					{
						return cd.ChunkName == chunk.Key;
					});

					if (!isExist)
					{
						ChunkDefinitions.Add(chunk.Value);
					}
				}
#endif
				if (bExcludeFromPaks)
				{
					return;
				}
Steps to Reproduce

1. Open the attached project in editor
2. Packaging project
    Then, pakchunk0.pak is created

3. Open PrimaryAssetLabel asset (PAL_50) and set ChunkID=5
4. Packaging project
    Then, pakchunk0.pak, pakchunk1.pak, pakchunk2.pak, pakchunk3.pak, pakchunk5.pak are created

Result:
Inconsistent chunks created. It appears that all settings in both PakFileRules and PrimaryAssetLabel are reflected and no chunk file(.pak) is created. 

Expected:
The created chunks are consistent. It is desirable that a chunk file(.pak) is created that reflects all the chunk settings defined in PakFileRules and the chunk settings set in PrimaryAssetLabel. Or, chunks should be created reflecting only the settings of PrimaryAssetLabel. 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-192370 in the post.

4
Login to Vote

Unresolved
ComponentUE - Foundation - Core
Affects Versions4.275.2
Target Fix5.6
CreatedAug 8, 2023
UpdatedOct 18, 2024
View Jira Issue