PlayerPref problems

Hi! In one script I have an if statement with the following code inside and it works.

PlayerPrefs.SetInt("SavedLevel1", 1);
PlayerPrefs.Save();

In another script I have another if statement

    if (PlayerPrefs.GetInt ("SavedLevel1") == 1) {  ... }

When I do debugging there is a problem in the second script with the if statement, nothing appears, like it wasn’t saved in the first script.
Any suggestions how can I make this work?

In another script I have another if statement

if (PlayerPrefs.GetInt ("SavedLevel1") == 1) {  ... }

When I do debugging (Debug.Log ( PlayerPrefs.GetInt (“SavedLevel1”)):wink: there is a problem in the second script with the if statement, nothing appears. Any suggestions how can I make this work?

In the first script, I have:

if (coins == 4 && Application.loadedLevel==2) {
PlayerPrefs.SetInt("SavedLevel1", 1);
PlayerPrefs.Save();
Debug.Log("SavedLevel = 1 ");
coins = 0;	  
yield return new WaitForSeconds (2);
Application.LoadLevel ("levels");
}

And secound one:

if (PlayerPrefs.GetInt ("SavedLevel1") == 1) {  
Debug.Log(PlayerPrefs.GetInt ("SavedLevel1"));
}

try declaring a variable

int pp = PlayerPrefs.GetInt("SavedLevel1");

Also, make sure the second script is called after the first.