Hello everyone
So this is the case:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class score : MonoBehaviour {
public float Score = 0.0f;
private int difficultyLevel = 1;
private int maxDifficultyLevel = 10;
private int scoreToNextLevel = 10;
private bool isDead = false;
public Deathmenu deathMenu;
public Text scoreText;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (isDead)
return;
if (Score >= scoreToNextLevel)
LevelUp ();
Score += Time.deltaTime * difficultyLevel;
scoreText.text = ((int)Score).ToString ();
}
void LevelUp()
{
if (difficultyLevel == maxDifficultyLevel)
return;
scoreToNextLevel *= 2;
difficultyLevel++;
GetComponent<playermotor>().SetSpeed (difficultyLevel);
}
public void OnDeath()
{
isDead = true;
deathMenu.ToggleEndMenu (Score);
if(PlayerPrefs.GetFloat("Highscore" < score)
PlayerPrefs.SetFloat("Highscore", score);
}
}
for some reason in the OnDeath section :
PlayerPrefs.SetFloat(“Highscore”, score);
Is not working.