public void SetInvisible() { sprite.color = new Color(1f, 1f, 1f, 0f); }
void OnTriggerEnter2D(Collider2D col) { //If the player collides with the patrolling enemy and not hiding if (col.gameObject.tag == "Player" && player.hide == false) { //Monster stops moving // speed = 0; //deactivate monster when colliding with player player.SetInvisible(); StartCoroutine("SetInactive"); } }