I’d like to create a function that runs a relatively complex math operation. I have the code already written in C++, but I’d like to be able to access this function from any blueprint, so that any of my actors (or even my level) can use it.
It’s in a custom MathsUtility class that I’m using to hold it as a static function, is there any way I can set this static function up to be access from any blueprint?
Yes, same way as you do it with any other functions, UHT will detect that this is static function and will generate node that won’t require “Target” Input
Ofcorse your class you put this in need to be UObject related and have UCLASS() in order for this to work, look on UGameplayStatics on engine source code for example
Hm. I had tried this with BlueprintPure and BlueprintCallable, but did not see my static function in the level blueprint available for calling. I will attempt again.
Also if you uncheck the “Context Sensitive” box in the blueprint thing when you right click to find a function, it’ll make EVERYTHING show up, including your custom stuff. That’s how I figured out how to see my C++ functions in blueprint.
Yeah I got it working. I had tried using BlueprintImplementableEvent in there and didn’t take it out so compiling was failing. It made me think it wasn’t possible.
If I recall correctly UE4 doesn’t support exposing template types to blueprint. There are a few exceptions for collections like TArray, but the type needs to be known or it won’t work.