Packaging: Additional Asset Directories - Does it actually work?

I’ve been having a difficult time getting my project packaged correctly.

I’ve reproduced this on 4.7 binary , and all versions of the 4.8 binary on Windows.

I’ve posted an answerhub issue a long time ago, here’s a stripped down super small project to reprothe issue.

The problem statement is that I’m referencing a texture in the constructor statics of a custom user widget:


UMyUserWidget::UMyUserWidget(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	struct FConstructorStatics
	{
		ConstructorHelpers::FObjectFinderOptional<UTexture2D> SomeTexture;


		FConstructorStatics()
			: SomeTexture(TEXT("/Game/UI/GamepadIcons/XboxOne/XboxOne_A"))
			{}
	};


	static FConstructorStatics ConstructorStatics;
	SomeTexture = ConstructorStatics.SomeTexture.Get();
}


I’ve tried specifying the folder **/Game/UI/GamepadIcons/XboxOne/ **in the additional asset directories to Cook/Package/Copy, both using a pak file and not. I can’t make any combination of these settings result in the texture being copied to the final packaged folder :frowning:

Can anyone show me what I’m doing wrong here? I’ve seen a few other threads on this issue but no clear answer on whether it is meant to work or known to be broken.

I’m going to bump this thread once a week until I have time to dig into the repo or until I die, whichever comes first.

I’ve been working around this on Windows by copying the extra content out of the Saved\Cooked folder after the build. But I haven’t found a simple workaround on mobile since the build and packaging are a bit more integrated. On Android I’d have to unzip the APK, throw the files in and then re-sign.

Still a problem, I will try against 4.9 as soon as it’s out the gate.

Hi,

did you tried in DefaultEditor.ini:
[UI]
+ContentDirectories=/Game/UI/GamepadIcons/XboxOne ?

I just gave that a quick run. It didn’t change anything, the content is cooked but not copied to the final package. Thanks for the suggestion though :slight_smile:

So I finally tracked down this issue in the master branch. You can see my answer here. The short story is that the staging copy system ignores folders whose name matches a platform string i.e. “XboxOne” unless you are building for that platform.

Well to be fair that makes sense.

I knew it… I literally just posted about this here haha, same folder name too!

The confusing part here is that if you use a pak file, the folder will be packaged regardless of name. Really there needs to be a checkbox for when you aren’t using a pak file that lets you explicitly choose to “Strip Files for Other Platforms”. And the tooltip could read “Hey, don’t name your folders after a platform name unless you want to waste 3 months of your life” :wink:

I’m guessing that most UE4 staff aren’t even aware of this, or else my answerhub post would have probably been flagged for using a folder with name XboxOne.

I’m using a PAK file and it still doesn’t package for me. I just had to rename the folder in the end!