Importing FBX files always creates new materials whether search location setting

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!

Hello htcJJl,

I was unable to reproduce the issue you are experiencing. I have a couple questions to help narrow down the issue you are experiencing.

  1. Can you reproduce this issue with a blank project?
  2. If so could you provide a detailed list of steps, so that I can reproduce this issue on our end?
  3. Could you provide screenshots of your issue?

Thanks!

Maybe you could see this page: Import Materials with Search Location: All Assets has stopped working in UE 4.17.1,
In my views, they have the same problem.

You could use the same FBX file and put it into different folders, and set “Material Search Location” to “All Assets” in Import setting window.
Maybe you will see duplicate materials and textures, that is the problem.

Thank you.

Hello again htcJJL,

I have reproduced this issue and logged a report for it here

You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Thanks!

Nice work, thanks for your help and reply

Hi,

We just tried out 4.18.1, and this bug prevents us from upgrading from 4.15. Every release since 4.13 has had some dealbreaking bug (most often in the fbx import functionality) that makes us either stick with old versions, or make our own custom version of the engine.

So, since the issue is now marked as fixed, but wont be implemented until 4.19 by the looks of it, can you provide the Git commit ID so we can fix it ourselves? We don’t have access to the perforce repo.

Thanks!

Hi this is still not fixed in 4.19.1, had to revert to 4.16.3

I may be having this same issue in 4.20. Could someone give me an idea if it is the same?

Problem still persist. May I add that it is possible to prevent the bug from happening by opening the Materials first, then importing the fbx.

We are often running into this issue when different devs are importing the fbx and creating the materials for it. Some fbx use previously made materials (synced with perforce). In these cases, the materials will not be assigned to the mesh, even with Search Location: All Asset selected and will leave the material slot empty. By first finding the materials, opening them and doing the whole operation again, the materials will indeed be found and assigned.

It’s a pretty annoying bug, we work with skeletal mesh with sometimes dozens of materials, not always from the same folder, which forces us to go material hunting in our project and redo the whole procedure.