Detecting collision multiple times for one impact.

I’m a beginner, in case that doesn’t become obvious very shortly.

I have a cube that I am moving around a plane with my mouse. It has a cube trigger collider and a rigidbody component attached. I have static trees that I downloaded from the Asset Store to which I added another cube trigger collider to. In my cubes script, I have both the onEnter and onExit trigger functions. They check if the other object is tagged as “Obstruction” which only the trees are, and if so they Debug.Log() “enter” and “exit”, respectively.

The issue is that once I move the cube into contact with one tree, my console fills up with:
“enter”
“exit”
“enter”
“exit”
“enter”
“exit”
etc…

Imgur gallery of the effect

I have the Cube’s script below, in full.

using System.Collections;

public class BuildingController : MonoBehaviour {

	public float range = 100f;

	Ray shootRay;
	RaycastHit shootHit;
	int terrainMask;
	int collisionCount;

	// Use this for initialization
	void Start () {
		terrainMask = LayerMask.GetMask ("Terrain");
		collisionCount = 0;
	}
	// Update is called once per frame
	void Update () {
		
		shootRay = Camera.main.ScreenPointToRay (Input.mousePosition);

		if(Physics.Raycast (shootRay, out shootHit, range, terrainMask))
		{
			transform.position = shootHit.point;
		}
		else
		{
			Debug.Log ("RayMiss");
		}

		if (Input.GetButton ("Fire1")) {
			Destroy (gameObject);
			//Place finalObject
		}
		else if (Input.GetButton ("Fire2")) {
			Destroy (gameObject);
		}

		//Debug.Log (collisionCount);
	}


	void OnTriggerEnter(Collider other) {
		if (other.tag == "Obstruction") {
			collisionCount++;
			Debug.Log ("enter");
		}
	}

	void OnTriggerExit(Collider other) {
		if (other.tag == "Obstruction") {
			collisionCount--;
			Debug.Log ("exit");
		}
	}
}

The problem was twofold.
I have my cube as a GameObject that a script was attached to, so it could be moved around with a mouse, and having a child GameObject with a mesh attached to it. While the root GameObject’s Collide was set to be a trigger, the child’s was not. This caused the object to be pushed out of contact with an obstruction each frame.

The second problem was the reason this went unnoticed. I had the object’s position being set every frame to the mouses position, regardless if the mouse had moved or not.
Setting the object’s position to only be only be updated when the mouse moved showed the object being pushed away from the obstruction and I tracked down the other Collider.

TL:DR: The object WAS being moved in and out of contact with the obstruction, but silly movement code hid the issue.

Thanks to @conman79 for his help.