So in my game I want to be able to restart by clicking twice within one second on a certain box, if they only click once than nothing happens, but when I try to implement this I get all sorts of errors about where to put what. Can someone explain what I am to do?
Here is the code I have so far
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Restart_Level : MonoBehaviour
{
public float timeleft;
float timeLeft = 1.0f;
private bool Confirm;
public int Save;
private void OnTriggerEnter(Collider other)
{
{
Confirm = true;
Save = Save + 1;
yield return new WaitForSeconds(1);
if (Confirm == true)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
if (Save == 1)
{
Confirm = false;
Save = 0;
}
}
}
}