Possible to make "global" functions?

So, I made this super complex mathematical formula function which returns how many dwarfs fit in a phone booth. Is it possible to save the function so I can use it in any bluprint in my project? Just like I can just drag out any of the builtin functions like Multiply, GetActorLocation or GetForwardVector?

Right now I simply do a copy&paste of the function into all the blueprints where I need to access the function. Which is not only time consuming (ok, I can afford the second it takes to copy and paste code) but also complicated if I want to edit the function. I need to change it in all my blueprints.

The function library is what you are looking for.
Right click - blueprints - blueprint function library.

5 Likes

Yay, thanks!!

@MemphisSnakes - will you be sharing your ‘super complex mathematical formula function which returns how many dwarfs fit in a phone booth’ function? :slight_smile:

oh as a side note you can create your own math nodes: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/MathNode/
(in case you didn’t know)

customize! :wink:

1 Like

Certainly not! You see, the game I’m working on is based on a truly unique and groundbreaking background story. One of a kind. I’d say the game is already a “classic” and they will be writing fan fictions about my game. I simply can’t share my dwarf function or people will reverse engineer the entire game concept and steal it. But as a teaser I can tell you this much, imagine being a giant yellow sphere. Struggling your way out through complex labyrinths. While having to eat dots to stay alive. Being hunted by several colored (24-bit coloring + alpha channel!!) ghosts controlled by a next-generation-AI which will actually try to stalk you through the labyrinth.

(Picture dramatic music while I was reading that out loud in a cool, deep dark voice)

I might consider sharing the function once the game is released. :slight_smile:

I didn’t know, actually. Thanks! The only issue I have with visual scripting is that it easily turns out to be huge chunks of operations which can be difficult to overview. It’s usually no problem while you’re in the middle of building a script, it’s when you open a project three months later and start wondering which part does what in ten feet of scripting graphs. Custom math nodes could actually shorten the chains significantly.

thanks a lot.
In case I might forget about it later.
Pardon me for writing some details here.

[operations]
1. open content browser
2. right click
3. click blueprint with a triangle icon behind it
4. select blueprint function library