Variables in arrays
I'm currently figuring out switch mechanism for equipment, weapons etc, and I'm not sure how arrays work. My question is that if u store let's say "firstweaponmagazine" in array and then call it later when it already changed by reloading will it call the proper variable or just the value it had in the moment of storing it in the array? If it doesnt work this way is there a way to achieve this? Also is it possible to make array of arrays?
asked Dec 23 '14 at 12:45 PM in Blueprint Scripting
What you store in an array is a reference to a variable. Not a value. This means it will always be the current value no matter where you changed it.
This also means you have to check if it's valid at all as it could be destroyed by the time you try to get it from the array.
If you want to have the variable at a specific moment you will have to create a new variable for this.
And no. As of yet multidimensional arrays (an array of arrays) is not possible right now in blueprint.
I hope this helps.
answered Dec 23 '14 at 12:54 PM
Hey, So something like this will store pointers to the objects, this means each variable stored in them will be update, i.e. the latest version of the variable. TArray myArray;
And I don't see why this wouldn't work: TArray> myArrayOfArrarys;
Hope that helps.
answered Dec 23 '14 at 12:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here