Hey, I am currently trying to spawn a function graph within my UBlueprint. It works but when I compile that new graph I get this compile error message:
void UMyBlueprintFunctionLibrary::CreateFunctionGraphs()
{
TSubclassOf<UEdGraphSchema> MySchema2 = UEdGraphSchema_K2::StaticClass();
UEdGraph* EventGraph = CastChecked<UEdGraph>(FBlueprintEditorUtils::CreateNewGraph(GEngine, NAME_None, UEdGraph::StaticClass(), UEdGraphSchema_K2::StaticClass()));
if (EventGraph) {
EventGraph->Rename(*FString("EdGraph_0"));
const UEdGraphSchema* Schema = EventGraph->GetSchema();
Schema->CreateDefaultNodesForGraph(*EventGraph);
GetBlueprintFromObject(GetSelectedBlueprint())->FunctionGraphs.Add(EventGraph);
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(GetBlueprintFromObject(GetSelectedBlueprint()));
FKismetEditorUtilities::CompileBlueprint(GetBlueprintFromObject(GetSelectedBlueprint()));
}
}
And indeed no such node spawns:
How do I spawn that Event/Node or how do I fix this error message?
My final goal is to create a function that simply spawns a new function as when you click on the + icon in the editor: