apple-picker/Assets/Scripts/Reset.cs

30 lines
734 B
C#
Raw Normal View History

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());
2024-02-08 19:15:28 -06:00
if (SceneManager.GetActiveScene().name == "_Scene_0") { this.gameObject.SetActive(false); }
else { this.gameObject.SetActive(true); }
}
void ButtonClicked() {
Time.timeScale = 1;
this.gameObject.SetActive(false);
2024-02-08 19:15:28 -06:00
SceneManager.LoadScene("_Scene_0");
}
// Update is called once per frame
void Update()
{
}
}