Hi there!
I’m currently struggling to achieve something with custom K2 nodes. I prefer not to explain why (it would be very long), but I would like to make a node that can expand like shown in the image below, when ExpandNode(…) is called at the expansion step of blueprint compilation.
The idea is to cut the execution flow and generate a custom event + a call to that event.
I know it sound very stupid presented like that, but actually this is just an example I made to ask my question. If someone can answer me, I will use that answer for a completely different thing. Quickly, it’s about an almost-pure node that would create an event and generate an object with a reference to this event to be fired later.
I know a bit the blueprint compilation process, but I’m still struggling to get my way with Delegates, FMemberReference(s) and UFunction(s)… Anyone has an idea on how to do it ?
I tried that, but it’s not working at all. It’s saying that a function called “DialogEvent_0” wasn’t found, as a compilation error log.
UK2Node_CustomEvent* EventNode = CompilerContext.SpawnIntermediateEventNode<UK2Node_CustomEvent>(this);
EventNode->CustomFunctionName = "DialogEvent";
EventNode->RenameCustomEventCloseToName();
EventNode->AllocateDefaultPins();
EventNode->GetPinAt(1)->MakeLinkTo(GetThenPin()->LinkedTo[0]);
GetThenPin()->BreakAllPinLinks();
UK2Node_CallFunction* FireEventNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this);
FireEventNode->SetFromFunction(EventNode->FindEventSignatureFunction());
FireEventNode->AllocateDefaultPins();
GetThenPin()->MakeLinkTo(FireEventNode->GetExecPin());