Okay so -
playerStrength = Random.Range (1, 6);
PlayerPrefs.SetInt ("strength", playerStrength);
works.
In a seperate script in the same project/different scene.
PlayerPrefs.GetInt("strength");
does not work.
It says Parser Error, '(, is wrong.
Also then when I put
Shamwow = PlayerPrefs.GetInt("strength");
it tells me that = isn’t allowed.
Quite confused as this is the same as the example here;
and here
Surely something else causes the trouble. If you could show you whole script and the exact compile error it would be easier to help :)
– dsadaParser Error; '(, is not defined in class, struct or declaration. It's the PlayerPrefs.GetInt("strength"); that's showing errors (even without Shamwow =) this is the code erroring, everything else works fine.
– DogOriginalBut this has nothing wrong with it. It should be something trivial syntax error. But the error is not with this line believe me :)
– dsadaLike @dsada is saying, this is not an error specific to that method. You likely just have a missing/unclosed parenthesis or semicolon or something somewhere earlier in the script.
– NoseKillsWhat the others said. When you make a typo somewhere, the parser sometimes starts thinking it's a whole different type of code. The result is odd errors because it thinks you started/ended an if statement/function/switch/mathematical operation somewhere you didn't.
– orb