Description

When a Blueprint asset is reloaded, we are currently serializing its CachedDependencies list during the discovery of potential referencers. This can lead to incorrectly treating all dependencies as a potential referencer.

This leads to unnecessary recompiles, increasing the reload time, and may result in undefined behavior due to circular reference relationships with the Blueprint asset that's being reloaded. For macro library dependencies, this will also lead to a recompile of any loaded Blueprint that also depends on that library.

Steps to Reproduce
  1. Launch a source build of the UE5 editor with the Visual C++ debugger attached, and open the attached project.
  2. Open BP_A, BP_B, BP_C and BP_D to ensure they are loaded. Note that they all have dependencies on the StandardMacros asset (via the event graph), and that BP_A has an additional dependency on BP_X (via a class variable).
  3. Open BP_X and add a new variable.
  4. Compile, but don't save.
  5. Close the Blueprint editor.
  6. In Visual C++, set a breakpoint in BlueprintCompilationManager.cpp on the following line in FBlueprintCompilationManagerImpl::FlushCompilationQueueImpl():
    for(UBlueprint* BP : BlueprintsToRecompile)
    
  7. Right-click on BP_X in the Content Browser and choose Asset Actions->Reload.
  8. Answer "Yes" to the reload confirmation dialog.
  9. Each time the breakpoint hits, note the value of BlueprintsToRecompile, which should show that BP_X will be compiled, along with the StandardMacros asset and all of BP_A, BP_B, BP_C, and BP_D (as well as other Blueprints that depend on the StandardMacros asset).
    Expected result: Only BP_X and BP_A are recompiled (BP_X because it is compiled on reload, and BP_A because it was found to have an existing dependency on BP_X).
Callstack

N/A

Have Comments or More Details?

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

1
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint
Affects Versions5.0
Target Fix5.1
Fix Commit21677066
Main Commit21688283
CreatedAug 25, 2022
ResolvedAug 29, 2022
UpdatedSep 11, 2022