Reseting materials color after mass selecting them during run time?

In my game I have it so that the player can select a unit and then select a tile in my grid for it to move to. I am showing that it is selected by changing the color of the tile and the unit clicked on. What I can’t figure out is how to deselect(change the color) the tile after the unit has been deselected or a new tile selected.

    using UnityEngine;
    using System.Collections;
    public class MousePower : MonoBehaviour {
    	//Raycasting Variables
    	private bool RayHit;
    	private Ray ray;
    	RaycastHit hit;
    	//Selection variables
    	private bool unitSelect=false;
    	public void mousePosRay(){ // Finds the object the user is mousing over
    		ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    		RayHit = Physics.Raycast (ray.origin, ray.direction, out hit);
    		Debug.DrawRay (ray.origin, ray.direction * 1000);
    	public void unitTileSelect(){
    if (hit.collider.gameObject.tag == "Unit"&&Input.GetButtonDown("Fire1")) {
    			else if(unitSelect==true){//deselecting
if (hit.collider.gameObject.tag == "Ground" && Input.GetButtonDown ("Fire2") && unitSelect == true) {;//shows tile selection
    	void Update () {
    		mousePosRay ();//Executes mouse position finding
    		unitTileSelect ();// Executes tile selection

Just keep a reference to the unit and the tile selected (like currentUnit and currentTile). When nothing is selected keep them as null (or any other default value). Whenever you select a new unit just check if the object your ray collides with is different from the reference unit. If different, turn currentUnit and currentTile back to normal color and update currentUnit. Whenever you select a new tile check it against currentTile. If different, turn currentTile back to normal color and update currentTile to the new tile selected.