health depleat with colliders

Im having a slight problem with some code and could do with some help. When the player is walking around their health depleats and when they enter these shelters their health stays the same. When they go back into the world their health should start to depleat again.

I have sent up colliders on the “shelters” and one over the entire level. When the user walks into the shelter the collider recognises this and stops depleating the health. When they walk out of the shelter though the health stays the same.

 function OnTriggerEnter(hit : Collider)
 {
if(hit.gameObject.tag == "shelter")
{
	print("You have entered a shelter. health will cease to depleat now"); //check if player has collided with a shelter - health will not depleat.
	healthDepleat = false;
	//health = health;
}
//else
if(hit.gameObject.tag == "level")
{
	print("Your on the surface, health will start to depleat"); //check if player is not in a shelter - health will depleat
	healthDepleat = true;
	//health--;
}
}

This is the code i have currently, any ideas on where i am going wrong. I need the code to recognise when the player has left that shelter of gone out of the collider. I have done it in Java

thanks in advanced

To detect when your player walks out of the shelter, you can use OntriggerExit, with that, you can keep track of the player entering and getting out of the terrain, it would be something like this:

        var hit: Collider;
         
        function OnTriggerExit (hit : Collider)
        {
        
        //Decrease Health

        }

Hope it helps.

Thank you very much