bMultiTargetFormat_ETC2

bMultiTargetFormat_ETC2

#Overview

name: bMultiTargetFormat_ETC2

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

It is referenced in 3 C++ source files. Also referenced in 1 C# build file meaning it may affect the build system logic.

#Summary

#Usage in the C++ source code

The purpose of bMultiTargetFormat_ETC2 is to control the inclusion of ETC2 textures when packaging with the Android (Multi) variant in Unreal Engine 5. This setting is specifically related to the texture compression and packaging system for Android devices.

This setting variable is primarily used in the Android Runtime Settings module of Unreal Engine 5. It’s part of the UAndroidRuntimeSettings class, which handles various configuration options for Android builds.

The value of this variable is set in two places:

  1. It has a default value of true, as seen in the constructor of UAndroidRuntimeSettings.
  2. It can be modified through the Unreal Engine editor, as it’s exposed as an editable property with the UPROPERTY macro.

This variable interacts with other similar variables, specifically bMultiTargetFormat_DXT and bMultiTargetFormat_ASTC. These three variables together determine which texture formats are included in the Android (Multi) variant package.

Developers must be aware that:

  1. At least one of these three texture format options must be enabled. If all are disabled, the engine will automatically set bMultiTargetFormat_ETC2 to true.
  2. Changing this value will trigger a notification to the AndroidTargetPlatform module if it’s loaded, potentially affecting the build process.

Best practices when using this variable include:

  1. Consider the target devices’ hardware capabilities when deciding which texture formats to include.
  2. Balance between texture quality and package size. Including more formats increases package size but improves compatibility and potentially visual quality across different devices.
  3. If targeting a wide range of Android devices, it’s generally recommended to keep this option enabled, as ETC2 is widely supported.
  4. Always test the resulting package on various target devices to ensure optimal performance and visual quality.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3065, section: [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:657

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:

	/** Include ETC2 textures when packaging with the Android (Multi) variant. */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = MultiTextureFormats, meta = (DisplayName = "Include ETC2 textures"))
	bool bMultiTargetFormat_ETC2;

	/** Include DXT textures when packaging with the Android (Multi) variant. */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = MultiTextureFormats, meta = (DisplayName = "Include DXT textures"))
	bool bMultiTargetFormat_DXT;

	/** Include ASTC textures when packaging with the Android (Multi) variant. */

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:39

Scope (from outer to inner):

file
function     UAndroidRuntimeSettings::UAndroidRuntimeSettings

Source code excerpt:

	, MinSampleRate(8000)
	, CompressionQualityModifier(1)
	, bMultiTargetFormat_ETC2(true)
	, bMultiTargetFormat_DXT(true)
	, bMultiTargetFormat_ASTC(true)
	, TextureFormatPriority_ETC2(0.2f)
	, TextureFormatPriority_DXT(0.6f)
	, TextureFormatPriority_ASTC(0.9f)
	, bStreamLandscapeMeshLODs(false)

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:212

Scope (from outer to inner):

file
function     void UAndroidRuntimeSettings::PostEditChangeProperty

Source code excerpt:


		// Ensure we have at least one format for Android_Multi
		if (!bMultiTargetFormat_ETC2 && !bMultiTargetFormat_DXT && !bMultiTargetFormat_ASTC)
		{
			bMultiTargetFormat_ETC2 = true;
			UpdateSinglePropertyInConfigFile(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UAndroidRuntimeSettings, bMultiTargetFormat_ETC2)), GetDefaultConfigFilename());
		}

		// Notify the AndroidTargetPlatform module if it's loaded
		IAndroidTargetPlatformControlsModule* Module = FModuleManager::GetModulePtr<IAndroidTargetPlatformControlsModule>("AndroidTargetPlatformControls");
		if (Module)
		{

#References in C# build files

This variable is referenced in the following C# build files:

Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:2741

					case "_Multi":
						//need to check ini to determine which are supported
						Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bMultiTargetFormat_ETC2", out bETC2Enabled);
						Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bMultiTargetFormat_DXT", out bDXTEnabled);
						Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bMultiTargetFormat_ASTC", out bASTCEnabled);
						break;
					case "_ETC2":
						bETC2Enabled = true;
						break;