Description

This issue is not a regression, it has been broken since the start of UE4. This bug may be related to [Link Removed] .

Per licensee:

We are trying to replace certain materials with material instances on many meshes at the same, by using the 'replace references' tool. However, if we specifically replace a material with a material instance, it fails to correctly assign the new material instance on any meshes that are currently not in memory. Instead, the objects will fall back to the worldgridmaterial on the next load (e.g. after restarting the editor, or using the 'fix-up redirectors' features).

The replacing seems to only fail if a material is replaced with a material instance. When a material is replaced with a material, then using 'fix up redirectors' will actually apply the correct new material to the mesh. Only for the instances it seems to make a difference whether an asset is in memory or not.

Steps to Reproduce
  1. Open empty project
  2. Copy Sphere from EngineContent/BasicShapes to Content folder and duplicate it so you have 'Sphere' and 'Sphere1'
  3. Create two new materials, 'Old' and 'New'
  4. Create Material Instance from 'New' -> 'New_Inst'
  5. Apply 'Old' material to both Sphere and Sphere1
  6. Save everything (see attached screenshot 'Setup')
  7. Close project and reopen
  8. To Trigger the bug, open ONLY one of the meshes by double clicking on 'Sphere'
  9. Select materials 'Old' and 'New_Inst' and replace 'Old' with 'New_Inst' using Right Click > Asset Actions > Replace References
  10. Delete 'Old' material when prompted

Result: Content Browser appears as shown in 'After' screenshot.

The mesh that was opened manually (Sphere) is marked as modified and has the New_Inst material applied as expected, however Sphere1 is not modified despite also having the 'Old' material. Right Clicking on Content Folder and selecting "Fix Up Redirectors in Folder" will replace the 'Old' material on Sphere1 with DefaultMaterial.

Callstack

From Output Log:

LogLinker: Error: Failed import: class 'Material' name 'Old' outer '/Game/Old'. There is another object (of 'ObjectRedirector' class) at the path.
LogLinker: Error: Failed import: class 'Material' name 'Old' outer '/Game/Old'. There is another object (of 'ObjectRedirector' class) at the path.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-55363 in the post.

1
Login to Vote

Won't Fix
ComponentTools
Affects Versions4.17.24.18.34.19
CreatedFeb 20, 2018
ResolvedAug 18, 2021
UpdatedAug 18, 2021