using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AttemptCounter : MonoBehaviour {
public Text AttemptText;
public int Attempts = 1;
public int AddAttempts = 1;
public void AddAttempt()
{
Attempts = Attempts + AddAttempts;
AttemptText.text = ("Attempts: " + Attempts.ToString(""));
Attempts = PlayerPrefs.GetInt ("Attempts");
PlayerPrefs.GetInt ("Attempts");
}
void Update()
{
AttemptText.text = ("Attempts: " + Attempts.ToString(""));
PlayerPrefs.SetInt ("Attempts", Attempts);
}
}
I Am Trying To Add a Attempts System In My Game, Every time a user will restart a level the game will add one attempt, however because when restarting the level it uses the code
SceneManager.LoadScene (SceneManager.GetActiveScene ().name);
It doesnt save the int meaning that its keeping the attempt counter on 1, can anyone help, Thanks.