I'm working on a custom built save system for a project a friend an myself are working on. Currently all variables that are saved to file, are stored as static variables in a global variables script file. The current save system involves running through each variable individually and saving it a line on a document, completely hard coded and very annoying to expand upon with new variables and elements in the game. I've decided to look into serialization of the global variables file, however static variables are not serializable. My solution is to use a getter and setter function, that is called instead of the direct GV.whatevervariable, that we currently use.
Ive been looking for something that allows me to store a variables name inside of another variable and then call it.
for example, say the variable in the GV script is A , the function would look like
static function getter(vget){
return GV['vget'];
}
var A : string = "testcode"
where the call code would look like:
var stuff : string = GV.Getter("A");
the problem with this though is that I keep getting "system.type does not support slicing" I currently cannot think of any other way to do this, and would really prefer not to hard code a getter and setter for each variable.