How do I stop a timer when a sphere gets to a certain point?

Basically I have set up a random grid using Primm’s Algorithm. When the game is started the grid is randomly generated with a start point (highlighted green) which is always at (0,0,0) and a randomly generated end point (highlighted red). I have placed a sphere on the start point for the user to navigate the grid/maze, and I have also created a timer that begins to count as soon as the game is loaded, but I want this timer to stop whenever the sphere hits the end point.

The timer I use is one I found on a tutorial site (don’t think I’m allowd to link to this site), but it doesn’t come with a stop clause. Is there any way in which to do this?

Hope this has been clear enough,
Thanks :slight_smile:

Without seeing the code, we cannot really help with whatever script you are using. If you have gotten that code from some site that prohibits you from re-distributing it, then try asking for support on that site.

Otherwise, consider writing your own. A very simple timer can be done like this:

public class Timer : MonoBehaviour 
{
	private static float currentTime = 0;
	private static bool running;

	void Start()
	{
		running = true;
	}

	void Update() 
	{
		if (running)
		{
			currentTime += Time.deltaTime;
		}
	}

	public static void StopTimer()
	{
		running = false;
	}

    public static void StartTimer()
    {
        running = true;
    }

	public static void Reset()
	{
		running = true;
		currentTime = 0;
	}

}

To detect your sphere object entering the end point, the simplest method would be to place a collider there and set it to be a trigger in the inspector. Then you write additional code to disable the timer when the sphere enters the trigger, utilizing the OnTriggerEnter() function.