how to write global variables as explained to me a horse girl by google because i asked.
things in parenthese are my assumptions and are probably wrong
Making a global variable in Unity is like having a prized stallion that everyone at the ranch knows by name. All the other horses (friendly mobs) and riders (enemies and maybe tack too?) can find and use him, no matter where they are. (this is an awkward metaphor but at least i understand it.)
Method 1: The static keyword (for simple stuff)
This is the most straightforward way, like using a simple corral everyone can walk up to. You create a simple C# script, but instead of attaching it to a specific object (stall or tackroom? a specific horse?), you use the static keyword to tell Unity that this variable doesn't belong to any one horse—it belongs to the whole stable.
(this next bit assumes your script is empty, but)
(so the public static class GlobalVars is the tackroom actually, and public static int are the gear, ostensibly like the pitchforks and shovels, the tack, the brooms? stuff you complete actions with, not objects in the code sense. maybe. and it's more like a food scoop that sits in one place, and you use the IDEA of scooping by thinking about the scoop itself, which is located in the tack room? this makes a lot of sense to me actually)