title: Unity game - Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
body: <p>for my game I created a prefab creating  a shop panel with a working button, text, etc in my tower defense game. I have a public bool of if the player has a tower, called hasTower as seen below.</p>
  
  <pre><code>public class CellScr : MonoBehaviour {
  
  public bool isGround, hasTower = false;
  </code></pre>
  
  <p>Later in the script, I have a code that if hasTower = true, that the system would find the game object from the prefab and destroy is (CloseShop).</p>
  
  <pre><code>    public void BuildTower(Tower tower) // From another script
  {
      GameObject tmpTower = Instantiate (TowerPref);
      tmpTower.transform.SetParent (transform, false);
      tmpTower.transform.position = transform.position;
      tmpTower.GetComponent&lt;TowerScr&gt;().selfType = (TowerType)tower.type;
  
      hasTower = true;
      FindObjectOfType&lt;ShopScr&gt; ().CloseShop;
  }
  </code></pre>
  
  <p>In Shop Script (a different script), I have the public method of CloseShop:</p>
  
  <pre><code>public void CloseShop()
  
  {
      Destroy(gameObject);
  }
  </code></pre>
  
  <p>which closes the window of the shop in my game.</p>
  
  <p>There is another script Tower Script, the bool determines if the player has a tower or not. In the ShopScr, there is also an option to build a tower based on your amount of gold. Including all these scripts will make the question too long, and those do not have the errors in them, as they work fine.</p>
  
  <p>The problem here is that the public bool doesn't work, and gives my the error: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement.</p>
  
  <p>How can I make the game recognize the method of CloseShop?</p>
  
  <p>Sorry this may be a stupid question, but I just started programming recently, especially with Unity.</p>