using UnityEngine; public class BackToStartButton : MonoBehaviour { public GameManager gameManager; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { if (gameManager == null) { gameManager = FindFirstObjectByType(); } } private void OnTriggerEnter(Collider other) { Destroy(other.gameObject); if (gameManager != null) { gameManager.StartMenuGame(); } } }