title: Is there a way to track how many times an object updates?
body: <p>I have a 2D game I'm working on that's similar to Minecraft, meaning lots of blocks are needed, and each one needs to update accordingly (to detect when the player wants to delete them). Currently it runs fine, but I have had issues in the past with frame rate and the number of blocks. </p>
  
  <p>The addition of blocks is currently done through listing as below</p>
  
  <pre><code> if (blockcheck &amp;&amp; game.build.BlockID == 1)
   {
      position2 = new Vector2(game.cursor.cursorPos.X + (float)30f, game.cursor.cursorPos.Y - (float)30f);
      position = new Vector2((int)(position2.X / 58) * 58, (int)(position2.Y / 58) * 58);
      game.blocktex1 = game.grass1;
      block = new Block(game, game.blocktex1, new Vector2(position.X, position.Y), layer, 0);
      blockpos1.Add(position);
      blocklayer1.Add(layer);
      blocklist.Add(block);
      placeblock = 200.0f;
  
   }
  </code></pre>
  
  <p>And then each block is updated with a simple <code>foreach</code> statement </p>
  
  <pre><code> foreach (Block b in blocklist)
   {
      b.Update(gameTime);
   }
  </code></pre>
  
  <p>What I would like to do is add a number + 1 each time a block updates. By doing so I think I should be able to tell what my update ceiling is, the only issue I'm seeing is that if I put simply</p>
  
  <pre><code> foreach (Block b in blocklist)
   {
      b.Update(gameTime);
      int updatenumber += 1;
  
   }
  </code></pre>
  
  <p>it will just add one for each block constantly, I feel it should be like if one block is updating, the update number should be one, if two blocks are updating the number should be two, and so on.</p>
  
  <p>how do I make it so it counts the number of objects updating, and doesn't add constantly?</p>