How to add a variable to a generated Blueprint?

Hi, I’m wondering if it is possible and if so, how, to add a variable to a generated Blueprint.

Specifically, I’m creating BPs using C++. I want to add variables to the blueprint during the creation process, and then add Get and Set nodes inside the event graph.

  • How do I add a variable to a UBlueprint object?
  • Are there classes like UBlueprintNodeSpawner for variable nodes? (didn’t find any function name for a Get node)

Thanks in advance.

I figured out a workaround that worked for me:

First, I created a blueprint from an Actor using FKismetEditorUtilities::CreateBlueprintFromActor.
Then, I retrieved the BP’s component hierarchy as an array of USCS_Node using Blueprint->SimpleConstructionScript->GetAllNodes().
With this, I could iterate over the components and find the ones I need programmatically. Then, I created UK2Node_VariableGet nodes using UBlueprintNodeSpawner and set their MemberReference.

This is enough to programmatically add Getter nodes to an event graph.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.