[Solved] Nativization - 4.20 worked, 4.21 does not (Circular dependency)

So after hours of digging around for an explanation to this lovely error message:


LogOutputDevice: Error: Ensure condition failed: PointerToUberGraphFrame->UberGraphFunctionKey == BPGC->UberGraphFunctionKey [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\BlueprintGeneratedClass.cpp] [Line: 1499]
  LogOutputDevice: Error: Detected key mismatch in uber graph frame for instance /Game/Creep/SpiderCreep/BP_SpiderCreep_Strider.Default__BP_SpiderCreep_Strider_C of type /Engine/Transient.REINST_BP_SpiderCreep_C_1, iteration will be unsafe
  LogOutputDevice: Error: Stack:
  LogOutputDevice: Error: [Callstack] 0x00007ffea92f2c43 UE4Editor-Engine.dll!UBlueprintGeneratedClass::AddReferencedObjectsInUbergraphFrame() [d:\build\++ue4\sync\engine\source\runtime\engine\private\blueprintgeneratedclass.cpp:1494]
  LogOutputDevice: Error: [Callstack] 0x00007ffeadf2111b UE4Editor-CoreUObject.dll!UClass::AddReferencedObjects() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:2872]
  LogOutputDevice: Error: [Callstack] 0x00007ffea9310a1b UE4Editor-Engine.dll!UBlueprint::ForceLoadMembers() [d:\build\++ue4\sync\engine\source\runtime\engine\private\blueprint.cpp:1157]
  LogOutputDevice: Error: [Callstack] 0x00007ffea932dc38 UE4Editor-Engine.dll!UBlueprint::RegenerateClass() [d:\build\++ue4\sync\engine\source\runtime\engine\private\blueprint.cpp:623]
  LogOutputDevice: Error: [Callstack] 0x00007ffeaded0361 UE4Editor-CoreUObject.dll!FLinkerLoad::RegenerateBlueprintClass() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\blueprint\blueprintsupport.cpp:731]

I finally found out what the issue was. We have a class “BP_SpiderCreep_Strider” which in a method spawns an actor of class: “BP_StriderDrone”. BP_StriderDrone has a field which can be set on spawn - the field refers (back) to the “strider”-actor who spawned it. This worked just fine with nativization in 4.20, but in 4.21 we had to change this to not be set on spawn, but rather set it right after spawn to get rid of the above error. Also we had to change it’s type to be “Actor” - which in this particular case with fine, but otherwise could have been very annoying.

I’m uncertain if its by design that this works without nativization, but breaks with nativization.