function Start() {
static var stopMoving = false;
}
now I can access this variable in other scripts by doing ‘GameController.stopMoving’ but when the variable is in start, I get this error:
BCE004: expecting }, found ‘static’
BCE004: expecting EOF, found ‘}’
but if I put ‘static var stopMoving = false;’ at the top and not inside any function, then I don’t get the error but I only want it to run once on startup so why can’t I put it in start?
Why is it static?
Im certain it being static is the issue but I cannot remember why.
Just remove it and tell me how it goes.
EDIT:
Read over the post again.
Instead of static why not make it public and create a reference instead. It wont be as clean if it works but a working solution is better than one that doesn’t.
Declaring a static variable in the scope of a funtion does not make sens (at least in C#).
Static means the variable belongs to the class not to the instances. It means that the variable is shared over all objects; changing the value from any object will change it for all objects. Is this you are expecting?