I want to create a Blueprint Function library call that maintains some arbitrary state each for each caller. So for a toy example, imagine a GetNextNumber blueprint function (in c++) that will simply return 1, 2, 3, 4, 5 each time it’s called. If there’s a blueprint that calls this function in two different places, then the streams of numbers would independent of one another.
Is there any clean/performant way to do this? I’m aware of a solution like using reflection and then grabbing the callstack, and then finally using a map or something to maintain state per caller. But that’s probably just going to brutalize performance.