0

i get this error:

Assets\Scripts\Player.cs(39,13): error CS0120: An object reference is required for the non-static field, method, or property 'Score.score'

if (Score.score == 50)
        {
            SpeedUp();
        }

        void SpeedUp()
        {
            double v = PlayerSpeed + 0.1;
        }
    } 

If i change the code int to static it fixes it but the player speed wont increase so that isnt an option.

I know that there are similar questions but they dont have the exact same problem as i do.

  • 1
    without having more of your code I would guess `Score` is a **type** not one of your fields and you would need a reference somewhere like `private Score score;` and then access `if(score.score == 50)` ... or well .. make the `Score.score` e.g. a `public static int score;` .. though you should be careful with simply making stuff `static` ;) – derHugo Aug 18 '21 at 14:45
  • thanks that helped – SNIELSEL Aug 18 '21 at 15:07

0 Answers0