UsePakFile

UsePakFile

#Overview

name: UsePakFile

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of UsePakFile is to control the packaging of game content into a consolidated file format. It is used in the packaging and distribution system of Unreal Engine 5.

This setting variable is primarily relied upon by the Project Packaging subsystem, which is part of the DeveloperToolSettings module. It’s used to determine how content should be packaged when building a game for distribution.

The value of this variable is set in the Project Settings, specifically under the Packaging category. It can be modified through the Unreal Editor interface or directly in the project configuration files.

UsePakFile interacts with several other variables, notably:

  1. bGenerateChunks
  2. bBuildHttpChunkInstallData
  3. bUseIoStore

Developers must be aware of the following when using this variable:

  1. When UsePakFile is true, all content will be packaged into one or more .pak files instead of many individual files.
  2. If bGenerateChunks is set to true, UsePakFile will automatically be set to true as well.
  3. If UsePakFile is set to false, both bGenerateChunks and bBuildHttpChunkInstallData will be set to false.
  4. When bUseIoStore is true, UsePakFile must also be true.

Best practices when using this variable include:

  1. Generally, it’s recommended to keep UsePakFile enabled (true) for most projects, as it helps with content management and loading times.
  2. Consider the implications on other related settings when modifying UsePakFile.
  3. If using IoStore or HTTP chunk install features, ensure UsePakFile remains enabled.
  4. When packaging for platforms or distribution methods that require individual files, you may need to disable UsePakFile, but be aware of the limitations this imposes on other features.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:91, section: [/Script/UnrealEd.ProjectPackagingSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:94, section: [/Script/UnrealEd.ProjectPackagingSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Classes/Settings/ProjectPackagingSettings.h:259

Scope (from outer to inner):

file
class        class UProjectPackagingSettings : public UObject

Source code excerpt:

	/** If enabled, all content will be put into a one or more .pak files instead of many individual files (default = enabled). */
	UPROPERTY(config, EditAnywhere, Category=Packaging)
	bool UsePakFile;

	/** If enabled, use .utoc/.ucas container files for staged/packaged package data instead of pak. */
	UPROPERTY(config, EditAnywhere, Category = Packaging)
	bool bUseIoStore;

	/** If enabled, use Zen storage server for storing and fetching cooked data instead of using the local file system.  */

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Private/ProjectPackagingSettings.cpp:115

Scope (from outer to inner):

file
function     void UProjectPackagingSettings::PostEditChangeProperty

Source code excerpt:

		if (bGenerateChunks)
		{
			UsePakFile = true;
		}
	}
	else if (Name == FName(TEXT("UsePakFile")))
	{
		if (!UsePakFile)
		{
			bGenerateChunks = false;
			bBuildHttpChunkInstallData = false;
		}
	}
	else if (Name == FName(TEXT("bBuildHTTPChunkInstallData")))

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Private/ProjectPackagingSettings.cpp:130

Scope (from outer to inner):

file
function     void UProjectPackagingSettings::PostEditChangeProperty

Source code excerpt:

		if (bBuildHttpChunkInstallData)
		{
			UsePakFile = true;
			bGenerateChunks = true;
			//Ensure data is something valid
			if (HttpChunkInstallDataDirectory.Path.IsEmpty())
			{
				auto CloudInstallDir = FPaths::ConvertRelativePathToFull(FPaths::GetPath(FPaths::GetProjectFilePath())) / TEXT("ChunkInstall");
				HttpChunkInstallDataDirectory.Path = CloudInstallDir;

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:431

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static void CookOrPackage

Source code excerpt:


			// Pak file(s) must be used when using container file(s)
			if (PackagingSettings->UsePakFile || PackagingSettings->bUseIoStore)
			{
				BuildCookRunParams += TEXT(" -pak");
				if (PackagingSettings->bUseIoStore)
				{
					BuildCookRunParams += TEXT(" -iostore");
				}