skip to Main Content

Understanding the Blueprint Function Library

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.

 

Avatar photo

This Post Has 8 Comments

  1. Hi.! Thanks for the tutorials, are so cool. i have a question in this point.
    When i call the funcion “UsefulFuncion”, got an error: This s not a MyHelperFuncions, therefore ‘Target’ must have a connection.
    What should be connected?

    1. Hello, does this appear on your Blueprint Editor? If so, can you provide a screenshot of your error?
      -Orfeas

  2. Hi Orfeas,

    Thanks for the tutorial! One thing I notice when I try to follow your tutorial is that you have to declare your functions as static, otherwise the editor would complain that “This s not a MyHelperFuncions, therefore ‘self’ must have a connection”.

    btw, I’m using 4.14 now.

    Thanks,

    Chenglin

Leave a Reply to Οrfeas Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top