Why aren’t these functions returning the same value? I’m trying to better organize my blueprints by moving certain things into functions but if the behavior changes when I use local variables then I have to use a global variable an it’s not as clean as I’d like it to be.
The difference in output is due to the local variable being reset to 0.0 (when the variable gets initialized) every time the function is being executed. As a result, in the local scenario, it’s always trying to interp from 0 to target, while in the global scenario, it’s doing so from last updated value to the target.
Local variables only exist within the scope of the function.When the function returns/ends the local variable is cleaned up. A member/global variable remains in scope as long as the Class/Blueprint exist.