I know it is failing me, it is for a video game and I cannot find a solution | SoloLearn: Learn to code for FREE!

+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

6/23/2020 4:28:00 PM

Jorge E.

3 Answers

New Answer

+2

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.

+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

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