# How do I create my own blueprint node with C++?

**URL:** <https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883>\
**Category:** Blueprint\
**Tags:** node, ufunction, unreal-engine, question, Blueprint, CPP\
**Created:** [September 29, 2014, 6:16pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883 "2014-09-29T18:16:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![iUltimateLP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@iUltimateLP](https://forums.unrealengine.com/u/iUltimateLP)\
**Post date:** [September 29, 2014, 6:16pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/1 "2014-09-29T18:16:16Z")

</div>

Hey there, I have a basic question, how can I implement own blueprint nodes into the game. I added C++ code to my game which class type is “EdGraphNode”. So it creates an .h and an .cpp file of my class. So this is the .h file:

```
#pragma once

#include "EdGraph/EdGraphNode.h"
#include "MyEdGraphNode.generated.h"

/**
 * 
 */
UCLASS()
class EDIFY_API UMyEdGraphNode : public UEdGraphNode
{
	GENERATED_UCLASS_BODY()
	
};

```

My .cpp file:

```
#include "EDIFY.h"
#include "MyEdGraphNode.h"

UMyEdGraphNode::UMyEdGraphNode(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	//
}

```

I read that I have to implement this UFUNCTION in the files, but where? My tries to implement the line there where the // stands, that doesn’t work for me. Please help!

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [September 29, 2014, 6:47pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/2 "2014-09-29T18:47:58Z")

</div>

It’s pretty stright forward, you just make function like normally do in C++ and just mark it with UFUNCTION before it’s decleration in with specific specifiers and UHT and reflections system will do the rest. Arguments of function will be inputs of node, arguments with refrence type (for example FString&) will be turned in to output, return value will also be output, if function is not static it will have “Target” input which you plug object on which you call the function on. UHT will add spaces to function and argument names before uppercase letters.

So for example:

```
UCLASS()
class EDIFY_API UMyNodes : public UObject
{
        GENERATED_UCLASS_BODY()

        UFUNCTION(BlueprintCallable, Category="My Nodes")
        static int32 SomeIntReturningFunction(FString Text, int32 Number, FString& TextOut);

};

```

Will create node named “Some Int Returning Function” node in category “My Nodes” (btw you can create subcategories with | symbol) which will have input for text and integer and text output as well as integer return output. Static will remoce “Target” input considering you making class for your nodes i assume you dont need that, or else you making nodes ofr perticilar class, then you need to place in to that class. You can use BlueprintPure insted BlueprintCallable so it will create passive node without action input output, you can also create events. here docs about this

> **[UFunctions](https://docs.unrealengine.com/5.1/en-US/ufunctions-in-unreal-engine/)**
>
> Reference for creating and implementing functions for gameplay Classes

Lot of specifiers are not documented, you can explore wiki which has some examples, also i recommend you to explore engine source code to see how default nodes are declered, because they declered the same way, you can also find how they are declered in API refrence, here example Int + Int math which specially stylized math node and you already probably seen it in blueprints:

> **[UKismetMathLibrary::Add\_IntInt](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/Kismet/UKismetMathLibrary/Add_IntInt/)**
>
> Addition (A + B)

Look of nodes made specially for blueprints are coded in UGamepleyStatics and UKismetMathLibrary, but practicly most gameplay classes has atleast few functions declered as nodes, they are marked with blue file icon in API refrece

You can expose C++ varables blueprint too with UPROPERTY(BlueprintReadWrite)

> **[Properties](https://docs.unrealengine.com/5.1/en-US/unreal-engine-uproperties/)**
>
> Reference for creating and implementing properties for gameplay classes.

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [September 29, 2014, 8:40pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/3 "2014-09-29T20:40:28Z")

</div>

I guess what you want is to create a new UK2Node?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [September 29, 2014, 9:44pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/4 "2014-09-29T21:44:41Z")

</div>

You only do that if you want to create custom kind of node, most things can be solved by functions

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [September 30, 2014, 7:14am UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/5 "2014-09-30T07:14:31Z")

</div>

This is why I’m asking him, creating a new node is quite some work but gives you additional power on what you can do while being a very advanced topic.

---

<div class="post-metadata">

**Author:** ![iUltimateLP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@iUltimateLP](https://forums.unrealengine.com/u/iUltimateLP)\
**Post date:** [September 30, 2014, 4:22pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/6 "2014-09-30T16:22:37Z")

</div>

Your function example doesn’t work for me. It says this: `Error	2	error LNK2019: Reference to non-resolveded external symbol ""public: static int __cdecl UMyEdGraphNode::SomeIntReturningFunction(class FString,class FString &)" (?SomeIntReturningFunction@UMyEdGraphNode@@SAHVFString@@AEAV2@@Z)" in Funktion ""public: void__cdecl UMyEdGraphNode::execSomeIntReturningFunction(struct FFrame &,void * const)" (?execSomeIntReturningFunction@UMyEdGraphNode@@QEAAXAEAUFFrame@@QEAX@Z)".	C:\Users\Johnny\Documents\Unreal Projects\EDIFY\Intermediate\ProjectFiles\MyEdGraphNode.cpp.obj	EDIFY `

---

<div class="post-metadata">

**Author:** ![iUltimateLP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@iUltimateLP](https://forums.unrealengine.com/u/iUltimateLP)\
**Post date:** [October 1, 2014, 4:20pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/7 "2014-10-01T16:20:02Z")

</div>

Ok made it at my one… Forget to do this  
void UTestEdGraphNode::TestFunction()  
{

```
}

```

in my .cpp file

---

<div class="post-metadata">

**Author:** ![Serellyn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Serellyn](https://forums.unrealengine.com/u/Serellyn)\
**Post date:** [May 4, 2015, 8:54pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/8 "2015-05-04T20:54:39Z")

</div>

Here’s a video tutorial 🙂 [Custom Blueprint Node, Return ProjectVersion - YouTube](https://www.youtube.com/watch?v=4UVdL4gHTOw)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_01dd28a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_01dd28a6](https://forums.unrealengine.com/u/anonymous_user_01dd28a6)\
**Post date:** [August 6, 2017, 11:55pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/9 "2017-08-06T23:55:58Z")

</div>

Also look in places in the engine source like

```
(Your UE4 Install directory)\Engine\Source\Runtime\Engine\Private\KismetSystemLibrary.cpp

```

for good examples.

---

<div class="post-metadata">

**Author:** ![FurrySparkle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FurrySparkle](https://forums.unrealengine.com/u/FurrySparkle)\
**Post date:** [April 11, 2023, 5:07pm UTC](https://forums.unrealengine.com/t/how-do-i-create-my-own-blueprint-node-with-c/294883/10 "2023-04-11T17:07:23Z")

</div>

they made a full guide. And like me for those using AI search and finding this thread from a super niche question on custom nodes in unreal. [Custom Blueprint Nodes: Exposing C++ to Blueprint with UFunction | Community tutorial](https://dev.epicgames.com/community/learning/tutorials/Klde/unreal-engine-custom-blueprint-nodes-exposing-c-to-blueprint-with-ufunction)
