I’ve heard that using static variables is bad practice, but I’m trying to make a static ‘library’ where in one function I set a variable, then in the second function I use that variable as a sort of constant and then that’s all it’ll do, what I have in mind is something like this
//DoMathsGood.js
static var constant : int
static function setConstant(i : int)
{
constant = i;
}
static function doMaths(a : int, e : int)
{
return a*(constant+e)
}
so then in some other script I can just go DoMathsGood.setContant(4) and whatever since “DoMathsGood” won’t be attached to a GameObject which is why I’m making it all static, the reason for this is I’m building a File IO Library that I want to be able to call from any script in the game, so would what I have work in theory?