How to use different assets depending on packaging settings?

I want to make slightly different builds for different regions(e.g. china, eu). Basically I want to decide which assets are going to be used in the game during building/cooking/packaging stage. It’s similar to C++ conditional compilation, but regarding to UE assets. When a user changes game language on runtime, region-specific assets should remain the same. And also assets from other regions should not be presented in shipped package.

Does anyone have any idea how this can be achieved?

1 Like

I’m sorry for the very lazy answer from my end, but there is a setting to exclude assets and folders in a build. These settings should be saved in .ini files usually in projectname/config. You can probably setup a system or a way to change the folders, alternatively add some functionality to swap.

There might be a better already implemented solution, but that is one solution that I thought of just now.

Oh… are you aware that there is a Project Launcher, it’s used for advanced packaging.
bild

Thanks. You gave me an idea. Maybe, what I want can be achieved by generating CoreRedirects that redirect each “global” asset to the corresponding “region-specific” asset. Looks a little bit hacky, but may work

Also Asset Groups can be helpful

Config/Custom/China/DefaultGame.ini:

[/Script/UnrealEd.ProjectPackagingSettings]
InternationalizationPreset=CJK
!CulturesToStage=
+CulturesToStage=zh-Hans-CN

Config/Custom/China/DefaultPakFileRules.ini:

[ExcludeContent]
bOverrideChunkManifest=true
bExcludeFromPaks=true
+Files=".../Content/Localization/Game/zh-Hans/..."
+Files=".../Content/L10N/zh-Hans/..."

Config/Custom/Global/DefaultGame.ini:

[/Script/UnrealEd.ProjectPackagingSettings]
InternationalizationPreset=All
!CulturesToStage=
+CulturesToStage=ar
+CulturesToStage=en
; ...
+CulturesToStage=zh-Hans

Run UAT like this:

Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -CustomConfig=China #...
2 Likes