Help me plz

I’m new to C# and Unity, and I’m getting an error and I don’t know how to fix it. I get “The name Console does not exist in the current context” and error CS0029: “Cannot implicitly convert type ‘int’ to ‘bool’” this is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HurtBrick : MonoBehaviour

{

int resistence = 2;

private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.CompareTag(“Ball”))
{
FindObjectOfType().CheckLevelCompleted();
Console.WriteLine(resistence - 1);

}
if(resistence = 0)
{
Destroy(gameObject);
}
}
}

unity has its own Debug.Log()

(although you can probably use console also, if you add using System;
Visual studio should offer that for a quick fix, if you mouse over that red squiggly line at Console.WriteLine… row?

ps. check these c# scripting tutorials or Unity Learn tutorials for easier start

Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

The complete error message contains everything you need to know to fix the error yourself.

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)
  • also possibly useful is the stack trace (all the lines of text in the lower console window)

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.

Check your comparison closely. Double equal is comparison, single is assignment.