Search Unity

Question Cannot implicitly convert type 'string' to 'bool'

Discussion in 'Documentation' started by Porcubear, Apr 2, 2021.

  1. Porcubear

    Porcubear

    Joined:
    Mar 26, 2021
    Posts:
    2
    Code is this
    void OnColliderEnter(Collider other)
    {
    if (other.gameObject.tag = ("Pickup"))
    {
    other.gameObject.SetActive(false);
    }
    }
    }
    error is Cannot implicitly convert type 'string' to 'bool' on the red text.
    Why?
     
  2. = - assigning value to a variable
    == - checking if the value of a variable is equal to something