Blueprint macro libraries referencing C++ functions cause 'Graph is Linked to External Object' error on hot reload

If I have a UFUNCTION that is referenced by a macro library, when hot-reloaded, this leads to a ‘Graph is Linked to External Object’ error when trying to save any blueprint that uses said macro. Doing “File → Refresh All nodes” on the macro library followed also refreshing and recompiling the blueprint seems to fix it.

Unfortunately, there is no indication of which macro library is the culprit at any given time.

Even knowing, it’s already becoming untenable to use macro libraries as such, even with only a few blueprints, since this happens for every hot reload, not just reloads that change the UFUNCTION.

It would be nice if the engine could refresh at least the macro library automatically, so only blueprints would need refreshed. Refreshing everything would be ideal, of course.

edit: Details!

Should reproduce, though I haven’t tried it twice:

  1. Create a new C++ class based on Blueprint Function Library.
  2. Add a function.
  3. Create a Macro Library; this can probably be based on anything. I’ve used both ActorComponent and Object.
  4. Reference the C++ function in the Macro Library.
  5. Use the macro in a blueprint (let’s say an ActorComponent).
  6. Cause your C++ to be rebuilt, resulting in a hot reload
  7. Modify and try to save the latter ActorComponent. This should result in the error.

The code is being compiled directly into the game in this case, not a plugin.

edit 2: There is also an USTRUCT that is pass-by-reference to the macro and function. I’m not sure if this changes anything. The USTRUCT is declared in the same file as the Blueprint Function Library.

edit 3: Updated to 4.14.3 and this still seems to be an issue. Going to try making a plugin for this code and see if I can isolate the “utility” stuff from the main game code, and if this will at least reduce the frequency of having to refresh everything.

Hey rpav-

Can you provide details on how you’re setting up your macro library? Also, where in your code is your UFUNCTION? Is it part of another actor/gamemode/ other class? If you can provide the reproduction steps that produce the behavior it will help me in investigating the problem and identifying the cause.

Sorry, long day and overcaffeinated post! Updated with details though I can’t seem to make the formatting work.

Thank you for the repro steps. I was able to confirm the save issue and a report for the issue has been logged here: Unreal Engine Issues and Bug Tracker (UE-39438) . 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. In the meantime, I’ve moved code to a plugin, and all plugin-related macros to a single macro library. This seems to make updates manageable, and not require refreshing after every game compile.