Corrupt top mips post packaging

I’m not sure where to start debugging this.

The skinny is:

  • Building pak files in non code project
  • Pak files contain WAV and PNG ussets
  • Loading the pak files in a more complicated code project
  • Mounting the pak files, and getting the engine to recognise them using FPackageName::RegisterMountPoint(“/DLC/”, PakFileMountPoint);
  • This works fine for non cooked assets
  • And seems to work okay for IOS textures
  • But Windows/Mac standalone builds have lost the top mip maps.

I’ve attached some images. In this case the top mip is looking at another texture. This is typical but some of the time they are displaying garbage, or partially garbage textures.

Is there something I need to do to make sure the UTextures are fully setup and stable post creation? The code below is what I’m using to load them (it looks for the original png file first for some backwards compatibility loading png’s downloaded from the interwebs, does not represent final code in any way):

        FString fullName = rFileRoot + "/" + m_FileName;
	if (!FPaths::FileExists(fullName))
		//Let's try loading a uasset instead.
		FString path = FPaths::GetPath(fullName);
		FString basename = FPaths::GetBaseFilename(fullName);
		FString uasset = path / basename + ".uasset";
		if (FPaths::FileExists(uasset)) 
			Outputf(_T("Data_RawImage::Load: No file: %s but %s exists"), *fullName, *uasset);
			FString unrealPath = "/DLC" / FPaths::GetBaseFilename(m_FileName, false); 
			auto ret = Cast<UTexture>(StaticLoadObject(UTexture::StaticClass(), NULL, *unrealPath, *uasset));

Any pointers on how to even start debugging this would be awesome - I’m not really a graphics programmer, and definitely not an unreal engine graphics programmer.

My workaround is to pak and load png files directly. I’d prefer to leverage all the work that’s gone into the asset package system though so this isn’t ideal.