Original message (verbatim)
CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Placeholders such as %s / %d are kept verbatim from the engine source and are not replaced with concrete values.
Trigger
The method body contains an expression that cannot form a statement (a stray comparison or arithmetic, a literal, a wrong discard, or an expression used as a statement), and compilation reports CS0201.
Typical cause
C# allows only assignment, call, increment, decrement, await, and new expressions as statements; every other expression is treated as an invalid statement.
Step-by-step fix
- Assign the expression result to a variable or use it in an if or return.
- Remove the stray comparison or arithmetic expression written as a statement.
- Check that method call parentheses and semicolons are placed correctly.
Source links
Per-entry sources and capture date are listed at /sources#U25.
Related errors
Related Unity errors
Need an offline quick-reference checklist?
Atlas error library Pro pack: 123 error references (110 single + 13 merged) plus a quick-fix guide, $19 one-time purchase, delivered as electronic files.
Back to the all-errors index Checkout and buy the Pro pack — $19.00