Как остановить таймер и перенести результат на другую сцену?

Мне нужно остановить таймер после касания с коллайдером. После перенести результат на другую сцену. Вот код таймера

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class time : MonoBehaviour
{

    public float timeStart;
    public Text textTimer;
    // Start is called before the first frame update
    void Start()
    {
        textTimer.text = timeStart.ToString("F2");
    }

    // Update is called once per frame
    void Update()
    {
        timeStart += Time.deltaTime;
        textTimer.text = timeStart.ToString("F2");
    }
}

Код который отвечает за переход на другую сцену

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class End : MonoBehaviour
{

  
  
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            //SceneManager.LoadScene("EndGame");
        }
      
    }
}

Ответы (0 шт):