I am having an issue with virtual shader source paths on engine version 5.2. In my plugin module, I have the following code:
void FMyPluginModule::StartupModule()
{
const FString ShaderDirectory = FPaths::Combine(IPluginManager::Get().FindPlugin(TEXT(“MyPlugin”))->GetBaseDir(), TEXT(“Shaders”));
AddShaderSourceDirectoryMapping(TEXT(“/MyPlugin”), ShaderDirectory);
…
}
When packaging everything seems to work just fine when included with several different projects. However, when packaging one particular project, I get the following error:
UATHelper: Packaging (Windows): LogShaders: Error: Can’t map virtual shader source path “/MyPlugin/MyPluginShader.usf”.
UATHelper: Packaging (Windows): Directory mappings are:
I am then given a list which does not include the mapping set in my plugin’s StartupModule() method. However, calling ShaderCore::AllShaderSourceDirectoryMappings() at run time returns a list of paths that matches the list in the error (Though in a slightly different order) AND also includes the path set in my plugin’s StartupModule() call. This inconsistent behavior has been very confusing. Does anyone have any ideas what might be going on, and why the module would package correctly when included in some projects but not in others?