| 1234567891011121314151617181920212223242526 |
- 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<GameManager>();
- }
- }
- private void OnTriggerEnter(Collider other)
- {
- Destroy(other.gameObject);
- if (gameManager != null)
- {
- gameManager.StartMenuGame();
- }
- }
- }
|