bfl_h2

Sometimes, we want to create functions which are going to do useful stuff and we don’t care which blueprints can call them. We want these functions to be included in every blueprint in our project. Unreal Engine provides a very easy way to create such functions. Let’s see how we can create them!

Creating such functions

I created a class named MyHelperFunctions which inherits from Blueprint Function Library Class. After the load is complete, you will notice that this class does not contain any default logic or declarations. Instead, the header file contains only the default GENERATED_BODY() macro as seen below:

bfl_h1

Right after the GENERATED_BODY() macro I type in the declaration of my function like the following image suggests:

bfl_h2

After that, I switch to the corresponding source file and type in the following functionality:

bfl_s1

Once you compile your code and switch to any blueprint graph you will notice that if you search the “UsefulFunction” you can call it without doing anything else.

 

Share postShare on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0