The function PlayerPrefs.GetInt takes only one parameter: the key. You're probably confusing it with setint, which takes two parameters: key and the value you want to set this particular key.
There is also another strange thing. You seem to look for two different keys, "PlayerAchievement1" and "PlayerAchievement2" but I imagine you want to check only one key "PlayerAchievement" and see if it has value of 1 or 2. Is that it? Try the code below, but beware that you also need to write the code that writes this playerprefs correctly!
if (PlayerPrefs.GetInt("PlayerAchievement") == 1)
{
rank.renderer.material.mainTexture = RankTexture[0];
}
else if (PlayerPrefs.GetInt("PlayerAchievement") == 2)
{
rank.renderer.material.mainTexture = RankTexture[1];
}
edit: Actually, you might actually be looking for different achievements and checking their value as true (1) or false (2). In that case, try this code instead:
if (PlayerPrefs.GetInt("PlayerAchievement1") == 1)
{
rank.renderer.material.mainTexture = RankTexture[0];
}
else if (PlayerPrefs.GetInt("PlayerAchievement2") == 1)
{
rank.renderer.material.mainTexture = RankTexture[1];
}
↧