title: bool variable don't change in unity 3d
body: <p>I'm trying to make a bomberman like game in unity and learning c# in the same time.</p>
  
  <p>I try to change the bool value of targetDestroyed1 var in my code but it seems that there is a problem..</p>
  
  <p>The issue:
  in the GetNearestTaggedObject1 when a object is founded, the targetDestroyed1 becomes true. but in the if (!targetDestroyed1) condition of InstantiateFire(), targetDestroyed1 always stay false and the instantiate continue instead of stop</p>
  
  <p>Here is my code:</p>
  
  <pre><code>private bool targetDestroyed1;
  
    void  Start (){
  OriginXplosion = new Vector3(transform.position.x, transform.position.y, transform.position.z); 
  InstantiateFire();
  }
  
  void  Update (){ 
  if (target1 != null) {
          Destroy (target1);
      }
  
  public void  InstantiateFire (){
      FireRate = player_actions.FireRate;
      FireRate -= 1;
      targetDestroyed1 = false;
  
      for(int i1= 0; i1 &lt;= FireRate; i1++){
              float i1_axeZ= transform.position.z + i1;
          if(i1_axeZ &lt;= 7)
          {
              if (!targetDestroyed1)
              {
                  Instantiate (ParticulesFeu, Axe1[i1].transform.position, ParticulesFeu.transform.rotation);
                  ScanForTarget1();
              }
          }
  }
  Destroy (gameObject);
  }
  
  void  ScanForTarget1 (){
      target1 = GetNearestTaggedObject1();
  }
  
  
  GameObject GetNearestTaggedObject1 (){
  
      float nearestDistanceSqr= 0.2f;
      GameObject[] taggedGameObjects= GameObject.FindGameObjectsWithTag(searchTag); 
  
      foreach(GameObject obj in taggedGameObjects) {
  
          Vector3 objectPos= obj.transform.position;
          float distanceSqr= (objectPos - transform.position).sqrMagnitude;
  
          if (distanceSqr &lt; nearestDistanceSqr) {
              target1 = obj;
              targetDestroyed1 = true;
              nearestDistanceSqr = distanceSqr;
          }
      }
  
      return target1;
  }
  
  }
  </code></pre>
  
  <p>Thank you for your help !</p>