Hi, I’m quite new to unity and I can’t figure out why this isn’t working, I’ve use a very similar code elsewhere with no issues. I am trying to set the PlayerPrefs int only if the number is higher, for example if the Playerpref is already 3(highest) then I don’t want it to change the amount to 2 or 1. The number is being set regardless of if it is higher or lower, does anyone know why or if there is a different way to code this? I’ve included part of the script because it’s pretty long, it all works except the && 2 >PlayerPrefs.GetInt(“Level1”). Any help would be much appreciated.
IEnumerator Star()
{
currentLevel = SceneManager.GetActiveScene().buildIndex;
if (lives >= 2 && lives < 4 && livesHolder.activeSelf|| lives2 >= 2 && lives2 < 4 && livesHolder2.activeSelf)
{
if (currentLevel == 1 && 2 >PlayerPrefs.GetInt("Level1"))
{
PlayerPrefs.SetInt("level1", 2);
}
,