I know it is failing me, it is for a video game and I cannot find a solution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I know it is failing me, it is for a video game and I cannot find a solution

In the && operand it tells me that you cannot apply "Boolean" and "string" operands, so I don't know what could be wrong with me. https://code.sololearn.com/cQCzfyXnjr6X/?ref=app

23rd Jun 2020, 4:28 PM
Jorge E.
Jorge E. - avatar
3 Answers
+ 3
Also, Line 42 if (_collision.gameObject.CompareTag("Coins") && ("Obstaculo")); This is incorrect. 1. CompareTag() returns a bool, as it should, but you're &&ing it with ("Obstaculo") which is just a string. 2. The if statement is followed immediately by a semicolon, so it has no body.
23rd Jun 2020, 7:10 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You can not declare a class inside the Main() { } function! I suppose you just copied this source code from somewhere. Also, some libraries definition are missing from the header part (using ...). Nested types: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/nested-types
23rd Jun 2020, 7:08 PM
Vasile Eftodii
Vasile Eftodii - avatar
0
ok thanks it is for a game in unity, only in that line 42 an error appears and maybe someone knew why it is failing me
23rd Jun 2020, 8:12 PM
Jorge E.
Jorge E. - avatar