I have a script called Game_Manager, where I declare a global variable: static var walk_speed = 0;
And then access it like this from other scripts: print (Game_Manager.walk_speed);
My problem is I can access it from one script with no problem, but from the next script I need to access if from I just get an “Unknown identifier: Game_Manager” error. I’m accessing it exactly the same in both scripts (even copy/pasted to be sure).
Game_Manager is parented to an empty game object. The two scripts that need to access it are a script called Character_Control that is parented to my character, and a script called MouseOrbit that is parented to my camera (the latter being the one that doesn’t work).
Hmmm… it seems to have something to do with where my scripts are located in the file system. While moving them around in the project view I did get it to work at one point, but then I broke again and I can’t remember what I did to make it work . I’m afraid I don’t quite understand the rules and restrictions regarding accessing global variables and so far I haven’t been able to find anything in any of the documentation that explains it.