I am geting a strange error

i am on arogon asalt in the unity course and i am getting an error that says this Assets\score.cs(7,9): error CS0542: ‘score’: member names cannot be the same as their enclosing type. here is my code
Screenshot 2022-03-27 133826

Hi,

C# is case-sensitive. The class and the variable are both named score. The compiler cannot distinguish between the names, hence it does not know if you mean the class or the variable in the IncreaseScore method. That’s why you are getting this error.

Did this help you fix the issue?


See also:

it did help evrything works now thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms