When I add a new local variable into my function, it just adds a node with an output of the type I assigned with no way to change it or assign it a value (no Get or Set). Is there something I’m missing?
Do you have to use a local variable? Try clicking the variable button at the top of that window.
I am not sure what local variables are used for, but I always use the other method for mine.
I thought a local variable was more appropriate, since the variable only needs to exist within this function so I assumed this was the best choice?
Honestly I am not sure, but I do know that the local variable doesn’t start with the functionality of set and get, so if you need those functions it may be best to use the other variable.
Hmm, so does anyone have a clue as to what I could do to get this working with a local variable? Or is it really not possible to do this with it at the moment?
After some toying around, the blueprint node I was looking for was simple called Assign. Problem Solved.
@Wisdomcube2000 It wouldn’t be appropriate, because the idea is to have your variable scoped to only that function, as in… outside of that function it has no context and doesn’t even exist.
@Zeustiak I myself expected to be able to get/set local vars just like any other, the assign doesn’t suffice because it creates a new var every-time you use it. It seems these bp functions need some work or I’m not understanding them fully.
I can see the need for something like that.
I would be interested to know what kind of performance difference it makes though. I can see cases for better performance using either variable type.
- A local variable is created, destroyed, and forgotten about.
- A global variable that stays in the memory and has better retrieval times than creating a local from scratch(like creating instanced static mesh components rather than many duplicated static meshes) . This would give you incentive to reuse globals as much as possible.
Or maybe they just haven’t exposed more local variable functionality from the source?
I am not a programmer so I can only speculate.