apple-picker/Assets/Scripts/Reset.cs
2024-02-08 19:15:28 -06:00

30 lines
734 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Reset : MonoBehaviour
{
public Button m_ResetButton;
// Start is called before the first frame update
void Start()
{
m_ResetButton.onClick.AddListener(() => ButtonClicked());
if (SceneManager.GetActiveScene().name == "_Scene_0") { this.gameObject.SetActive(false); }
else { this.gameObject.SetActive(true); }
}
void ButtonClicked() {
Time.timeScale = 1;
this.gameObject.SetActive(false);
SceneManager.LoadScene("_Scene_0");
}
// Update is called once per frame
void Update()
{
}
}