Pass Content Window Actors/BlueprintFunctionLibrary to C++ Function

Hi,

i would like to know how I can pass the actors or my BlueprintFunctionLibrary in my content window to c++ functions.
Is there a way to do that?

Basically pass this:

to this:

258024-1.png

It would also be ok if I could just use a UPROPERTY:

258025-1.png

But I cannot select this library, why does it not show up in this list?

258026-1.png

What can I do to access this function library?

I think you misunderstanding the role of BlueprintFunctionLibrary. Technically you can do blueprints nodes on in any UObject and AActor based class (so practically anywhere), BlueprintFunctionLibrary only exists for static functions for nodes that you can not logically relate to any of the classes you have or you want to or you want to make node out of something that can not be direly exposed to blueprint (like non-UObject class or C++ struct functions).

For example all math functions in C++ inside UE4 are packed to FMath structure, blueprint don’t support functions in structures and also math operators from C++ (aspecially for premitive types) can not be bind to blueprint, there for UBlueprintFunctionLibrary class was made called UKismetMathLibrary (Kismet is node scripting system in UE3 and blueprint suppose to be Kismet 2.0 thats why you can still see that name in UE4) which contains static function with all math operations which are bind to blueprints, and only reason why they are there is due to limitations of blueprints.

What im getting at? Those libraries suppose to only contain static functions and object for then should not be never created, if you corner yourself to need to pass blueprint library as object that means you doing something wrong. if you want to create node for object it should be in class of that object, if you need global variable for any node operations you place those in either GameMode or GameInstance or PlayerController. So you probably need to reconsider what you doing, you didn’t explained why you doing this so i can’t really suggest you anything here.

Now the reason why you don’t see those object is something compliantly different. You can see object in property editor only in those cases:

1.Object you trying set property in exists on the level (this includes World Settings and Level Blueprint) and object you trying to set property in exists in exact same level

2.Object is registered asset on content editor (like UTexture, UStaticMesh etc)

Reason why you can do that only in those cases is because you making a class not a object and when object of a class is created there no guaranty that selected object will exists on creation of that object, or else those consitions are met. If you have object already created on the level editor there guaranty that other objects saved on the level will also exist, thats hwy you can select them, if you spawn object of class in any other moment there no guarranty that those object exist anymore… there no guarranty you spawn on same level you editing, how UE4 suppose to know that? thats why you can not to do that on raw blueprint class. While assets in content browser exists in asset registry and will be packaged in the game so UE4 can also ensure of existence of those objects in any moment.

You can only select class (UClass* or TSubclassOf) anywhere and then create object of it in the blueprint.

If oyu don’t understand, think blueprint as C++ class (because thats essentially what it is) and in C++ you can not just grab C++ class and call function on it or else functions are static, you need a object to be made of that class, blueprint is exactly bound to same limitation. “Class” as name suggest just defines class/type of objects not the object instance.

Yes I see. But are the function library functions not static? In C++ when I create a class and a static function within it, I do not have to create an instance of that class to call the static function. That is what I want to do with the function library. Basically my function library has a function called “PrintScreen”. Because I created that function in the function library I though it would be a staic function and I would not have to create an instance of this “class” (this blueprint) to call it. So this is basically what I want to do, I want to call the function in the function librarary without creating an instance of the blueprint “class”. In C++ I would just include the header file and call the static function. In blueprints I thought that I would have to pass the blueprint as a property and call the static function with the passed property. I see that this does not seem to be correct. So how would I do that with blueprints (calling static blueprint functions from the function library in c++)?

No, again there nothing special about BlueprintFunctionLibrary is practically empty class just made to store static functions, you need to declare static functions like this:

UFUNCTION(BlueprintCallable)
static void SomeFunction();

And oyu can declare static functions in any class and structure, but to make blueprint node out of those you need to do it in any UObject

Static function uses class they are in just as namespace and you don’t need any instance of object to call it just call it like this

UMyFunctionLibrary::SomeFunction();

Thank you for the answer. I understand what you are saying, at least I think so, but I did not decleare the function in c++. I decleared the function as a blueprint. So basically like this:

As you can see, there is no c++ source or header file.
What I want to do is either “#include” the blueprint somehow to call the function, or pass the class in some other way to call the function. What I am trying to say is that I cannot call the function without including or passing something, because it would be not definined then. I need to give c++ some kind of definition of this function so it can be called, wheter it is through an include or not I do not know.

Maybe I am just beeing stuped right now, and if so I apologize for that, seems like I am not a very smart man.