Highlighting with a Raycast

When i drag around a tile i want to highlight a field once the ray shot by the card hits a field or another card. That works so far.

Now when the Raycast is not hitting this field or card anymore, i want to disable it.

if(Physics.Raycast(ray, out hit, 15))
		{
			if(hit.collider.tag == "SnapField")
			{
				hitPlayfield = true;
				hitCard = false;
				//highlight the field
				HighLightField = hit.collider.transform.FindChild("HighLightField").gameObject;
				HighLightField.SetActive(true);

				newPosition = hit.collider.gameObject.transform.position;
			}

			else if(hit.collider.tag == "card")
			{
				hitPlayfield = false;
				hitCard = true;
				//Highlight the field
				HighLightField = hit.collider.transform.FindChild("HighLightField").gameObject;
				HighLightField.SetActive(true);

				newPosition = hit.collider.gameObject.transform.position;
				DT = hit.collider.gameObject.GetComponent<DragingTiles>();
			}
		}
		else
		{
			hitPlayfield = false;
			hitCard = false;

		}

Where and how can i disable that HighlightField GameObject?

I would think you just need to add one more condition to your if statements, for when the tag is NOT “snapField” or “card”. You probably also want to SetActive(false), on the highlightfield:

 if(Physics.Raycast(ray, out hit, 15))
 {
        if(hit.collider.tag == "SnapField")
                     {
                         ....
                     }
                     else if(hit.collider.tag == "card")
                     {
                           ...
                     }
                     else
                     {
                        hitPlayfield = false;
                        hitCard = false;
                        //HighLightField = hit.collider.transform.FindChild("HighLightField").gameObject;
                        if(HighLightField!=null)
                             HighLightField.SetActive(false);
                    }
}
else
{
                        hitPlayfield = false;
                        hitCard = false;
                        //HighLightField = hit.collider.transform.FindChild("HighLightField").gameObject;
                        if(HighLightField!=null)
                             HighLightField.SetActive(false);

}

Edit: remarked out an incorrect line in last else segment, would cause null reference exception. Also, added null check. I now ASSUME that HighLightField, is a class member, initialized to NULL.