About return pins on BPs

Does functions create a temporary class variable (property) when they have a return pin and are placed in the event graph?
Because the shown on the image below will work forever, it will never crash or return something like “null int”


Does this means that if i have a lot of function nodes returning a huge struct they will each one create a persistent variable?

1 Like

Hey @thelukasoliver!

Yes, it does, which is why there are many, many ways to store a variable! This is more of a “Local Var” situation. You don’t want to have a lot of blueprints generating a lot of new variables all at once, but you can do things like save variables to a SaveGame file to load it into ROM instead of RAM if it’s REALLY big.

But usually, storing the variables like this really isn’t an issue- they vary, but most types of variables are INCREDIBLY small. Bits and bytes, not Kilobytes or Megabytes.

Also you don’t necessarily want to include EVERY variable you can fit into one struct- if that struct includes unused variables it’s wasted overhead! :slight_smile:

1 Like