The easiest way I can think of is:
-
Get the plugin template (Plugins | Unreal Engine 4.27 Documentation) from UE4 Editor for a Blueprint Function Library
(last time I checked, 4.27 didn’t have all the usual plugin templates, so use prior version if necessary) -
Add your code there.
Now you have a plugin that contains statically accessible nodes to do the math logics you want, which means they can be called from anywhere, without instancing an object.
If you need persistent variable storage over time, so it can’t be just a single blueprint node, then yes, adding an object to handle all of your math logic is viable, I have a tutorial related to that here:
UObjects for fancy C++ Code
- I do recommend using a plugin even for your uobject class, which you can just add to your BP Library plugin somewheres. Reason: You could eventually add your plugin to the marketplace, and especially in UE5, plugins compile VERY fast, and even within Epic, many projects, I’ve observed, have tended to start using plugins for different aspects of a larger project.
So Plugins are very much the
Hot Pink Sparkly Rainbow of Excitement
These days, in the UE World…
(The only Real World)!
Enjoy!
Rama