How can I share a variable between two functions is the functions libraray?

is it possible?

This is not possible. Function Libraries are uses for functions which are simply callable from everywhere and without any state to it.

Use Actor or ActorComponents instead.

One caveat about the above: It is possible if you define the function library in C++. Which is probably not the case since this is the Blueprint subsection, but still, for the sake of completeness you can create Blueprint function library functions that share variables. Whether you should is a different question that can almost always answered with “no”.

1 Like

If you really want to do this and decide to use the Blueprint proxy class method, you have to be aware of object lifecycles, though! Game modes and game states get reset with every level change, so whatever you store in there does not persist throughout the game’s run. The game instance would be a safer place to store globally accessible variables that need to survive map changes.