I’m still trying to create an “Inverse Bool”(bool = !bool) blueprint state. Ideally I would’ve wanted 1 input, which would get the variable by reference and change it. Now, when I do this :
void MyLibrary::InvertBool(bool& a)
{
a = !a;
}
then all I get in the editor is an output. I don’t want both an input AND an output for such a small action, so I was wondering, how can I access blueprint variables directly from a script? I wasn’t able to find the Get/Set Variable function in the source.
Ideally, what I’d want would look like this (Pseudocode):
you will be able to use any library functions you want as BP nodes in ANY blueprint
enjooooy!
**My Wiki Tutorial**
https://wiki.unrealengine.com/Blueprint_Function_Library,_Create_Your_Own_to_Share_With_Others!
**[BP Function Libraries](https://wiki.unrealengine.com/Blueprint_Function_Library,_Create_Your_Own_to_Share_With_Others!)**
I believe that node already exists, called ‘NOT Boolean’. It has a boolean input pin and boolean output pin. Generally that is the way you want to build functions exposed to Blueprints, rather than using in/out parameters.
thanks, yes that’s what I was looking for.
Just to clarify though, is there no way to pass a struct by reference? Ideally I would only want 1 input pin and no output pin, so the graph could look more tidy.
You can pass a struct by reference. By default Blueprints treat ‘const ref’ parameters as input and ‘ref’ parameters as outputs. However, you can use a UPARAM macro to tell it that a ref parameter is actually an input. Here is an example: