I’m attempting to spawn a macro intermediate node in the ExpandNode method of a custom UK2Node of mine. This is a snippet of how the macro node is being created:
UPackage* StandardMacrosPackage = FindObjectChecked<UPackage>(
nullptr, TEXT("/Engine/EditorBlueprintResources/StandardMacros"));
UBlueprint* StandardMacrosLib = FindObjectChecked<UBlueprint>(StandardMacrosPackage, TEXT("StandardMacros"));
UEdGraph* ForEachMacro = FindObjectChecked<UEdGraph>(StandardMacrosLib, TEXT("ForEachLoop"));
UK2Node_MacroInstance* ForEachNode = CompilerContext.SpawnIntermediateNode<UK2Node_MacroInstance>(
this, SourceGraph);
ForEachNode->SetMacroGraph(ForEachMacro);
ForEachNode->AllocateDefaultPins();
UEdGraphPin* MacroExecPin = ForEachNode->FindPinChecked(TEXT("Exec"));
UEdGraphPin* ArrayPin = ForEachNode->FindPinChecked(TEXT("Array"));
And then I’m wiring up the pins. However, when I compile my node in the editor, I get the following error:
Unexpected node type K2Node_MacroInstance encountered at Execute Bound Query
Can macro nodes not be created within ExpandNode? I was hoping they would be treated like any other node and be expanded recursively.