I have a tool in the game I am making that is supposed to absorb one unit of water and then place it somewhere else when you fire at the other place. I want to make it so that the player could only collect one unity of water at a time so I made a global variable called waterfull to see if the player’s watertank is full or not. Its supposed to not absorb water when the tank is full. However when I try to check if the global variable waterfull is fall (true) or empty (false) from a different script unity says BCE0005: Unknown identifier: ‘WaterApparatus’. WHY??? All the script reference says To access it from another script you need to use the name of the script followed by a dot and the global variable name.print(TheScriptName.someGlobal);
TheScriptName.someGlobal = 10;
As far as I am concerned that is what I did.
How I declared the variable in a separate script called waterApparatus:
static var waterfull : boolean = false;
Where I am trying to use this variable to check if the player has already absorbed water:
function OnTriggerEnter (other : Collider) { if (other.gameObject.CompareTag ("water") && waterApparatus.waterfull==false){ WaterApparatus.waterfull=true; Destroy(other.gameObject); } }