No folder hierarchy in intermediate folders breaks my project!

Dear Epic staff,

I am facing some annoying issues while integrating Google Protobuf based projects into Unreal Engine.

My file hierarchy in the plugin folder looks like this:

│   └───common
│           └── common.proto    
        │        └── common.proto    
        │        └── common.proto    
        │        └── common.proto    
                 └── common.proto    

So when compiling, I get unresolved symbols, because all common.proto files (compiled into common.pb.h and are put into the same folder in the intermediate directory and silently overwriting each other:


Is there a way to work around this UBT behaviour or do you have an answer to why this is implemented like this? Will I break UBT when changing this part of the compile process? Maybe because of 255 char file-paths restrictions?

This code area (L.1195) in VCToolchain.cs looks like it causes this with CompileEnvironment.OutputDirectory always the same:

// Add the object file to the produced item list.
FileItem ObjectFile = FileItem.GetItemByFileReference(
  Path.GetFileName(SourceFile.AbsolutePath) + ObjectFileExtension