How to store 'this' pointer to UBlueprintFunctionLibrary?

I created my UBlueprintFunctionLibrary-derived class with member functions and private variables.

I’m using it from blueprints by creating an instance of that class with the construct object from class node. My question right now is: how do I store the this pointer to the object just created? How do I store the object just created so I can call another member function later from blueprint?

I managed to set a very generic Object type variable with the object reference return value from that node, but I can’t cast it back to my UBlueprintFunctionLibrary-derived class afterwards.

engineering wise is not the best you wanna do.
anyhow, “this” pointer is of a specific class. you can make a function that take that type of pointer as input and assign it as to the private variable.

second way is that if your class has a static pointer of itself that will be initialized at creation. then in your blueprint library you can access that self reference ( this however is limited to one pointer per class since it’s static )

Thank you, what would work best in this case? I mean: having a C++ stateful class with functions and events that can be used from blueprints. If UBlueprintFunctionLibrary isn’t the best choice, what alternatives do I have?

yes,
UBlueprintFunctionLibrary is equivalent of an static class. now in such case you can’t have all the pointers stored. perhaps if you can elaborate more why you ee such case i can help you more.

Sure, I need to initialize something OS-specific when a blueprint node is called and then keep it active for the entire duration of the program. Then deinitialize it when another blueprint node is called. This stuff has plenty of OS-specific pointers, handles and the like so I need a class instance to store them.