the console says that i need an ‘;’ in line 6 where i have a ‘)’
and i need a ‘:’ where i have ‘+=’
1. public var nextNumber : int = 0;
2.
3. GetNextNumber;
4.
5. function GetNextNumber () {
6. for ((PlayerPrefs.HasKey(nextNumber)) == true) {
7. nextNumber += 1;
8. }
9. }
It looks like you meant that to be a while loop; for loops don’t work like that. Also, all you need here is “PlayerPrefs.HasKey(nextNumber)
” rather than “(PlayerPrefs.HasKey(nextNumber)) == true
”. Additionally, “GetNextNumber;
” is an error. You call functions like this: “GetNextNumber();
”. And that line should be inside a function, such as Start or Awake, since code that “does stuff” should be inside functions. Only global variable declarations should be outside functions.