title: having trouble passing variables between two game objects
body: <p>I have a bunch of soil patch game objects which can be turned into flowers. I want to click on flower and open up a new menu. But the soil patches get clicked accidentally when I click on the menu buttons. So I set up a bool so that the soil patches can be turned on and off.</p>
  <p>Soil patch code has a bool active. This is what I'm doing in the flower code:</p>
  <pre><code> void OnMouseDown()
      {
          public GameObject[] soilpatches= GameObject.FindGameObjectsWithTag(&quot;Soilpatch&quot;);
          foreach (GameObject soilpatch in soilpatches)
          {
              SoilPatch _soilpatch=soilpatch.GetComponent&lt;SoilPatch&gt;();
              _soilpatch.active=false;
          }
      }
  </code></pre>
  <p>But it keeps giving me compile errors.</p>
  <p>EDIT: 'active' is a bool I've set up inside the soilpatch script.</p>