title: Enable/disable a BoxCollider via script
body: <p>My player has an weapon in his hand, which swings on attack and deals damage when it hits the enemy. But i want the collider to be able only when the player is attacking, when pressing F for example. What i have  > </p>
  
  <pre><code>GameObject weapon = transform.FindChild("orc_weapon").gameObject; 
  
  if(Input.GetKey(KeyCode.F))
              weapon.GetComponent&lt;PolygonCollider2D&gt;().enabled = false;
  </code></pre>
  
  <p>For some reason this destroy my player gameobject.... i also tried getting the weapon with       GameObject weapon = GameObject.Find("orc_weapon");  In this case, when i press F i get the unassigned exception weapon has not been assineged, i Debuged it and it prints orc_weapon</p>