Materials are broken when loaded from a pak file

I’ve managed to set up a relatively basic custom map system using Steam Workshop and pak files. I have a template project with a custom plugin capable of cooking, packaging, and uploading the pak to steam, and then my game basically just trolls steamapps/common/workshop/content/ for all pak files and mounts them at Game/Content/CustomMaps/UGC using FPakPlatformFile.

This is (mostly) working. I am able to load the map up in my game and all the geometry is there. The issue is that this scene:

ends up looking like this when actually loaded into the game:

I know that the ‘grass’ material is found by the engine because it no longer defaults to the grey grid texture. The lens flare (?) only appeared after I turned on the forward renderer in my template project (my game uses the forward renderer). Neither the lens flare or the black material are present in the template project. I have both a skylight and a lightmass importance volume in this map.

I’ve now removed the skylight/importance volume and replaced the green texture with the blue texture which had appeared to work.

[This is the result.][3]

What’s really interesting is that this happens seemingly randomly. If I keep loading up the map through the console, it will sometimes make the drop pod purple like in the video, sometimes it will be black like the landscape, and sometimes it will be all weirdly lit like in the picture. The landscape material NEVER works, regardless of what it is.

This is the code I’m using to load my paks:

void UProxyWarGameInstance::MountPak(FString PakFileName) {
	UE_LOG(LogTemp, Log, TEXT("MountPak(%s)"), *PakFileName);

	// get mod UID
	FString PathPart, FilePart, ExtPart;
	FPaths::Split(PakFileName, PathPart, FilePart, ExtPart);
	FString PathPart2, ModUID, ExtPart2;
	FPaths::Split(PathPart, PathPart2, ModUID, ExtPart2);
	UE_LOG(LogTemp, Log, TEXT("ModUID=%s"), *ModUID);

	IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
	FPakPlatformFile* PakPlatform = new FPakPlatformFile();
	PakPlatform->Initialize(&PlatformFile, TEXT(""));
	FPlatformFileManager::Get().SetPlatformFile(*PakPlatform);
	
	if (PakPlatform->Mount(*PakFileName, 0, *(FPaths::GameContentDir() / FString("CustomMaps/UGC") + ModUID))) {
		UE_LOG(LogTemp, Log, TEXT("Successfully mounted %s at %s"), *PakFileName, *FPaths::GameContentDir());
	}
	else {
		UE_LOG(LogTemp, Warning, TEXT("Failed to mount %s"), *PakFileName);
	}
}

Any ideas what’s going on here? I’m pretty stumped.

Okay i fixed this on my own. The issue was that rendering settings in the template project were not the same as in the actual game, so the cooked materials were loading wrong

Thanks you very much for that. Would never have thought about the rendering settings to be the issue.

Im on the same thing for creating mods via steam workshop. You said template project, is that available for public?

I basically just made a blank blueprint project but added this plugin i made https://github.com/SlimeQ/UE4-Steamworks and another plugin containing important c++ classes and asets. It makes a toolbar for you, ignore the readme. It’s technically a fork