error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

Hello, I am new to unity and c# so I’m having a problem solving this error. I was trying to make the score go up by 1 every time the player collects a coin but I keep getting an error called this: Assets\Script\ScoreManager.cs(17,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement for my score manager script. Please help, and thank you.203049-screenshot-192.png

,Hi, I’m new to c# so I’m having a hard time trying to fix this error. I’m trying to make the score go up by 1 every time the player collects a coin but for the score manager script I’m getting this error Assets\Script\ScoreManager.cs(17,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement. Please help, and thank you.

Hey there,

you must always be really precise about using 1 = or 2 ==.

If you write

  instance = this;

you assing the current script to the variable instance

if you write

 instance == this;

you tell c# to compare instance with this. Which will result in true or false. But the compiler/programm will not know what to do this this result.

so in your case, just remove one of the = in line 17.