This bug has happened since 4.17 to now(4.18).
In versions before 4.16 is partial okay.
When FBX files are importing to Unreal, normally we can set the material search location to find previous importing materials with the same name, and then avoid duplicated textures being imported and duplicated materials being created.
But the above function is breaking now(After 4.17).
That is terrible because we usually need to reduce the game package as minimal as possible, this bug will cause the serious resource management problem.
I try to trace Unreal source codes by myself to compare difference between 4.16 and 4.18, the problem is seams caused by code changing of FbxMaterialImport.cpp.
After 4.17, the FindExistingMaterialFromSearchLocation() function is moved to MaterialImportHelpers.cpp, and function content is much different with the versions before 4.16.
I set break point to watch, and find that the string value of the variable MaterialFullName contains the specific folder path name, maybe it is the reason why the FindExistingMaterial() function always return NULL?
By the way, in versions before 4.16, the function is still not stable.
The CreateUnrealMaterial() function will create new materials with the texture name normally when previous materials are not found, and then it will change the imported texture name to avoid the name conflicting to the created material’s name.(Material name: {TextureName}; ImportedTextureName: {TextureName}_1)
That is fine, however, I don’t know why sometimes Unreal changes some material’s name rather than the textures name.(Material name: {TextureName}_1; ImportedTextureName: {TextureName})
If I import the same FBX file in the different folder, it can’t find those changed material’s name because Unreal expects the material name is the original texture name.
It means that “material search location” is partial okay before 4.16 and completed breaking after 4.17.
Hope it will be fixed as fast as possible, Thank a lot!