Why does this not work (Involves instantiating objects in response to a collision*)

Ok, so I am making an endless runner, and I am trying to make it so when the “player” object collides with a “marker” object it will spawn the next section of road (which contains another marker). All the road sections behind the player are deleted as they pass. My problem is that when the player collides with the marker, the next section of the road does not appear. I can’t figure out what I did wrong.

Here’s the Code:

using UnityEngine;
using System.Collections;

public class MarkerCollisionCheck : MonoBehaviour {
	
	public GameObject objectToSpawn = null;
	public GameObject spawnPoint = null;
	public bool spawning = false;

	void OnTriggerEnter(Collider other)
	{
		if(other.tag == "Player" && spawning == false)
		{
			spawning = true;

			Instantiate(objectToSpawn, spawnPoint.transform.position, Quaternion.identity);

			spawning = false;
		}
	}
}

Just in case I am misunderstanding, “Instantiate” spawns the object correct?
Notice that the “spawnPoint” is another object. If you need more information, just ask.

Thank You,
expat1999

Commented by Prlyanshu

code is correct.

For correct collision with trigger -

One of the 2 colliders must be marked as Trigger.

For collision to register. One of the 2 Colliders must be Rigidbody.

To check if collision is happening use Debug.Log